Advertisement
MawinCK

Test teleport to all script(useful for some game)

May 6th, 2024 (edited)
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. ---you could modify or edit this script as you own script that is better
  2. ---reset you character if you want it to stop
  3. local player = game.Players.LocalPlayer
  4. local service = game:GetService("Players")
  5.  
  6. local isTeleporting = false
  7.  
  8. function teleportRandomly()
  9. while isTeleporting do
  10. for _, otherPlayer in ipairs(service:GetPlayers()) do
  11. if otherPlayer ~= player then
  12. local character = otherPlayer.Character
  13. if character and character:FindFirstChild("HumanoidRootPart") then
  14. local humanoidRootPart = character.HumanoidRootPart
  15. local randomPosition = humanoidRootPart.Position + Vector3.new(math.random(-10, 10), 0, math.random(-10, 10))
  16. player.Character.HumanoidRootPart.CFrame = CFrame.new(randomPosition)
  17. wait(1) -- Adjust the wait time as needed
  18. end
  19. end
  20. end
  21. wait(0.1) -- Adjust the wait time as needed
  22. end
  23. end
  24.  
  25. game:GetService("UserInputService").InputBegan:Connect(function(input)
  26. if input.KeyCode == Enum.KeyCode.V then
  27. isTeleporting = not isTeleporting -- Toggle teleporting
  28. if isTeleporting then
  29. teleportRandomly()
  30. end
  31. end
  32. end)
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement