local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local Character = LocalPlayer.Character
local RootPart = Character.HumanoidRootPart
local stages = workspace.stages
local currentstage = LocalPlayer.leaderstats.Stage
local function FindNextPortal()
for i,v in pairs(workspace:GetChildren()) do
if v.Name == "Stage Teleport" and #v:GetChildren() == 4 then
local enter = v:FindFirstChild("enter")
if enter ~= nil then
return enter
end
end
end
end
local function Touch(Part)
firetouchinterest(RootPart, Part, 0)
firetouchinterest(RootPart, Part, 1)
end
while task.wait() do
local CurrentStage = stages:FindFirstChild(tostring(currentstage.Value))
local NextStage = stages:FindFirstChild(tostring(currentstage.Value + 1))
local NextNextStage = stages:FindFirstChild(tostring(currentstage.Value + 1))
RootPart.CFrame = CurrentStage.CFrame * CFrame.new(0,3,0)
if NextStage then
Touch(NextStage)
--Potential Speed Gain?
if NextNextStage then
Touch(NextNextStage)
end
else
local NextPortal = FindNextPortal()
if NextPortal then
RootPart.CFrame = NextPortal.CFrame
else
RootPart.CFrame = CurrentStage.CFrame
end
task.wait(1)
end
end
for i,v in pairs(workspace.badges:GetChildren()) do
if v.Name == "Platform" then
Touch(v)
end
endIt does the obby as quick as it can.
No comments yet. Be the first to comment!
1local Players = game:GetService("Players")
2local LocalPlayer = Players.LocalPlayer
3local Character = LocalPlayer.Character
4local RootPart = Character.HumanoidRootPart
5
6local stages = workspace.stages
7local currentstage = LocalPlayer.leaderstats.Stage
8
9local function FindNextPortal()
10 for i,v in pairs(workspace:GetChildren()) do
11 if v.Name == "Stage Teleport" and #v:GetChildren() == 4 then
12 local enter = v:FindFirstChild("enter")
13 if enter ~= nil then
14 return enter
15 end
16 end
17 end
18end
19
20local function Touch(Part)
21 firetouchinterest(RootPart, Part, 0)
22 firetouchinterest(RootPart, Part, 1)
23end
24while task.wait() do
25 local CurrentStage = stages:FindFirstChild(tostring(currentstage.Value))
26 local NextStage = stages:FindFirstChild(tostring(currentstage.Value + 1))
27 local NextNextStage = stages:FindFirstChild(tostring(currentstage.Value + 1))
28 RootPart.CFrame = CurrentStage.CFrame * CFrame.new(0,3,0)
29 if NextStage then
30 Touch(NextStage)
31 --Potential Speed Gain?
32 if NextNextStage then
33 Touch(NextNextStage)
34 end
35 else
36 local NextPortal = FindNextPortal()
37 if NextPortal then
38 RootPart.CFrame = NextPortal.CFrame
39 else
40 RootPart.CFrame = CurrentStage.CFrame
41 end
42 task.wait(1)
43 end
44end
45for i,v in pairs(workspace.badges:GetChildren()) do
46 if v.Name == "Platform" then
47 Touch(v)
48 end
49end