Advertisement
DanOnScripts

UNIVERSAL WIN OBBY

May 30th, 2024
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. local delay = 0.8
  2. local checkpoints = nil
  3. local plr = game.Players.LocalPlayer
  4. local val = 0
  5.  
  6. for _, check in pairs(workspace:GetDescendants()) do
  7. local lower = check.Name:lower()
  8. if string.find(lower, "checkpoints") then
  9. checkpoints = check
  10. break
  11. end
  12. end
  13.  
  14. if checkpoints then
  15. print("Found checkpoints:", checkpoints.Name)
  16. else
  17. print("No checkpoints found")
  18. return
  19. end
  20.  
  21. local stages = {}
  22. if checkpoints ~= nil then
  23. for _, stage in pairs(checkpoints:GetChildren()) do
  24. if stage.Parent.Name == checkpoints.Name then
  25. val += 1
  26. table.insert(stages, stage)
  27. end
  28. end
  29. end
  30. print(val)
  31.  
  32. for i = 1, val do
  33. local stage = stages[i]
  34. if stage:IsA("Part") or stage:IsA("MeshPart") then
  35. plr.Character.HumanoidRootPart.CFrame = stage.CFrame
  36. elseif stage:IsA("Model") then
  37. plr.Character:SetPrimaryPartCFrame(stage:GetPivot())
  38. end
  39. wait(delay)
  40. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement