random obby

Run Settings
LanguageLua
Language Version
Run Command
do local PhysicsService = game:GetService("PhysicsService") local PlayerService = game:GetService("Players") pcall(function() PhysicsService:RemoveCollisionGroup("PlayerCharacters") end) PhysicsService:CreateCollisionGroup("PlayerCharacters") PhysicsService:CollisionGroupSetCollidable("PlayerCharacters", "PlayerCharacters", false) local function characterAdded(character) for _, bodyPart in pairs(character:GetChildren()) do if bodyPart:IsA("BasePart") then bodyPart.CollisionGroup = "PlayerCharacters" end end end local function playerAdded(player) player.CharacterAdded:Connect(characterAdded) if player.Character then characterAdded(player.Character) end end for _, player in pairs(PlayerService:GetPlayers()) do playerAdded(player) end PlayerService.PlayerAdded:Connect(playerAdded) end local Floors = 10 local Rounds = 3 local PlayingRoundMode= true local lighting = game:GetService("Lighting") local Parts = 10 local Randomizer = Random.new() local Color1 = Color3.new(Randomizer:NextNumber(),Randomizer:NextNumber(),Randomizer:NextNumber()) local Color2 = Color3.new(Randomizer:NextNumber(),Randomizer:NextNumber(),Randomizer:NextNumber()) function Studify(Parts) for i,Part in pairs(Parts) do Part.TopSurface = Enum.SurfaceType.Studs Part.BottomSurface = Enum.SurfaceType.Studs Part.FrontSurface = Enum.SurfaceType.Studs Part.BackSurface = Enum.SurfaceType.Studs Part.LeftSurface = Enum.SurfaceType.Studs Part.RightSurface = Enum.SurfaceType.Studs Part.CastShadow = false end end local Tower = Instance.new("Folder",script) Tower.Name = "Tower" script.Name = "randomobbies" local YOffset = -16 local CF = CFrame.new() function new(i, p) local n = Instance.new(i) for j,v in pairs(p) do n[j] = v end return n end function getmax(t) local maxval, key = -math.huge, nil for k,v in pairs(t) do if v > maxval then maxval, key = v, k end end return key, maxval end function FUNNYSTART(b) local hahaha = { "On your marks!", "Get set!" } for joe = 1, 2 do b.Text = hahaha[joe] game:GetService("Debris"):AddItem(new("Sound", { Parent = script, Volume = 2, PlayOnRemove = true, PlaybackSpeed = 1.25, SoundId = "rbxasset://sounds/bass.wav" }), 0) task.wait(1) end task.wait(1) b.Text = "GO!!!!!" for _ = 1, 5 do game:GetService("Debris"):AddItem(new("Sound", { Parent = script, Volume = 2, PlayOnRemove = true, PlaybackSpeed = 1.5, SoundId = "rbxasset://sounds/bass.wav" }), 0) task.wait(0.1) end end local CheckpointsHit = {} local TotalCheckpoints = 0 local phys = PhysicalProperties.new(0.7, 0.3, 1, 1, 1) function CreateWalls(round) if owner.Character then CF = CFrame.new(owner.Character.Head.Position) else CF = CFrame.new(0, 1, 0) end Color1 = Color3.new(Randomizer:NextNumber(),Randomizer:NextNumber(),Randomizer:NextNumber()) Color2 = Color3.new(Randomizer:NextNumber(),Randomizer:NextNumber(),Randomizer:NextNumber()) local LY = 16 local LX,LZ = 0,0 local PartPlaces = {} TotalCheckpoints = math.round((Floors*Parts)/4) CheckpointsHit = {} local PartsP = {} local Winner = "" local doingstuff = true local h = Instance.new("Hint",script) task.spawn(function() for _,pl in game:GetService("Players"):GetPlayers() do PartPlaces[pl.Name] = 0 end for _,pl in game:GetService("Players"):GetPlayers() do CheckpointsHit[pl.Name] = {} end task.spawn(function() FUNNYSTART(h) task.wait(0.5) doingstuff = false end) while task.wait(0.2) do if Winner ~= "" then break end local form = "Highest player: %s with %s parts climbed! | Round: %s" local hp, hv = getmax(PartPlaces) if doingstuff == false then h.Text = form:format(hp or "", hv or 0, round) end end h.Text = ("Congratulations! %s has beat the obby!"):format(Winner) game:GetService("Debris"):AddItem(new("Sound", { Parent = script, Volume = 3, PlayOnRemove = true, SoundId = "rbxasset://sounds/victory.wav" }), 0) task.wait(3) if PlayingRoundMode == false or round >= Rounds then h:Destroy() end for i,v in pairs(PartsP) do game:GetService("Debris"):AddItem(new("Sound", { Parent = v, Volume = 2, PlayOnRemove = true, PlaybackSpeed = Randomizer:NextNumber(0.85, 1.25), SoundId = "rbxasset://sounds/snap.wav" }), 0) v.Anchored = false v.CustomPhysicalProperties = phys game:GetService("Debris"):AddItem(v, 5) task.wait(0.05) end print("Starting new round") doingstuff = true if PlayingRoundMode == true and round < Rounds then for i = 29, 1, -1 do h.Text = ("Starting next round in %s seconds..."):format(i) task.wait(1) end Floors = Floors * 1.5 h:Destroy() doingstuff = false CreateWalls(round+1) end end) local Start = tick() local TotalNum = 0 for i = 1,Floors do for j = 0,Parts do local parttype = Randomizer:NextInteger(1,5) local p if parttype == 5 or (i == 1 and j == 0) then p = Instance.new("TrussPart",Tower) else p = Instance.new("Part",Tower) local jam = math.random(1,3) if jam == 1 then p.Shape = Enum.PartType.Ball elseif jam == 2 then p.Shape = Enum.PartType.Cylinder end end local hbr, sbr, vbr = (Color1:Lerp(Color2,math.clamp(i/Floors,0,1))):ToHSV() local tn = TotalNum if tn%4==0 then p.Color = Color3.fromHSV(hbr, sbr, vbr/1.5) else p.Color = Color3.fromHSV(hbr, sbr, vbr) end local light = Instance.new("PointLight") light.Brightness = 1 light.Range = 10 light.Color = p.Color light.Enabled = false light.Parent = p p.Anchored = true if p.ClassName == "Part" and p.Shape ~= Enum.PartType.Block then p.Size = Vector3.new(Randomizer:NextInteger(2,5),Randomizer:NextInteger(2,5),Randomizer:NextInteger(2,5)) else p.Size = Vector3.new(Randomizer:NextInteger(1,5),Randomizer:NextInteger(1,8),Randomizer:NextInteger(1,5)) end p.Touched:Connect(function(hit) if game:GetService("Players"):GetPlayerFromCharacter(hit.Parent) then if tn % 4 == 0 then if not CheckpointsHit[hit.Parent.Name] then return end if CheckpointsHit[hit.Parent.Name][math.round(tn/4)] ~= true then game:GetService("Debris"):AddItem(new("Sound", { Parent = p, Volume = 1, PlayOnRemove = true, SoundId = "rbxasset://sounds/button.wav" }), 0) end CheckpointsHit[hit.Parent.Name][math.round(tn/4)] = true end PartPlaces[hit.Parent.Name] = tn end end) CF = CF * CFrame.new(math.random(-3, 3),math.random(0,5),math.random(6,9)) if i % 4 == 0 then CF = CF * CFrame.Angles(0, math.rad(math.random(-1, 1)*45), 0) end p.CFrame = CF Studify({p}) task.spawn(function() while task.wait() do if lighting.ClockTime <= 6 or lighting.ClockTime >= 18 then light.Enabled = true else light.Enabled = false end end end) if i == Floors and j == Parts then task.spawn(function() p.Touched:Connect(function(hit) if game:GetService("Players"):GetPlayerFromCharacter(hit.Parent) then if #CheckpointsHit[hit.Parent.Name] < TotalCheckpoints then task.spawn(function() doingstuff = true game:GetService("Debris"):AddItem(new("Sound", { Parent = script, Volume = 1, PlayOnRemove = true, PlaybackSpeed = Randomizer:NextNumber(0.85, 1.25), SoundId = "rbxassetid://8622490283" }), 0) h.Text = ("%s got yeeted by the anti-cheat system."):format(hit.Parent.Name) game:GetService("Players"):GetPlayerFromCharacter(hit.Parent):Explode() task.wait(3) doingstuff = false end) else Winner = hit.Parent.Name end end end) while task.wait(0.1) do p.Material = Enum.Material:GetEnumItems()[math.random(1,#Enum.Material:GetEnumItems())] p.BrickColor = BrickColor.random() end end) else end table.insert(PartsP, p) TotalNum += 1 task.wait() end task.wait() end end function toboolean(n) return (n == "true" and true) or (n == "false" and false) or (n == 1 and true) or (n == 0 and false) or false end owner.Chatted:Connect(function(msg) local Pre = "ro" local Split = msg:split("/") if Split[1] == Pre then if Split[2] == "partc" then Parts = tonumber(Split[3]) elseif Split[2] == "new" then Tower:ClearAllChildren() CreateWalls(1) elseif Split[2] == "mul" then Floors = tonumber(Split[3]) elseif Split[2] == "rm" then PlayingRoundMode = toboolean(Split[3]) elseif Split[2] == "rounds" then Rounds = tonumber(Split[3]) elseif Split[2] == "skip" then local user = Split[3] CheckpointsHit[user] = table.create(TotalCheckpoints, true) end end end)
Editor Settings
Theme
Key bindings
Full width
Lines