Advertisement
Parallaxox

Chosen Player Teleport SS

Apr 8th, 2025 (edited)
440
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.64 KB | None | 0 0
  1. --https://youtu.be/rvva4TSGunI
  2. local Players = game:GetService("Players")
  3. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  4. local Workspace = game:GetService("Workspace")
  5.  
  6. -- Setup shared value
  7. local chosenPlayerValue = ReplicatedStorage:FindFirstChild("ChosenPlayer")
  8. if not chosenPlayerValue then
  9.     chosenPlayerValue = Instance.new("StringValue")
  10.     chosenPlayerValue.Name = "ChosenPlayer"
  11.     chosenPlayerValue.Parent = ReplicatedStorage
  12. end
  13.  
  14. -- Setup spawn parts
  15. local chosenSpawn = Workspace:FindFirstChild("ChosenSpawn") or Instance.new("Part", Workspace)
  16. chosenSpawn.Size = Vector3.new(6, 1, 6)
  17. chosenSpawn.Position = Vector3.new(50, 3, 100)
  18. chosenSpawn.Anchored = true
  19. chosenSpawn.BrickColor = BrickColor.new("Bright green")
  20. chosenSpawn.Name = "ChosenSpawn"
  21.  
  22. local otherSpawn = Workspace:FindFirstChild("OtherSpawn") or Instance.new("Part", Workspace)
  23. otherSpawn.Size = Vector3.new(6, 1, 6)
  24. otherSpawn.Position = Vector3.new(-50, 3, 100)
  25. otherSpawn.Anchored = true
  26. otherSpawn.BrickColor = BrickColor.new("Bright red")
  27. otherSpawn.Name = "OtherSpawn"
  28.  
  29. -- Pick one random player and teleport
  30. local function chooseRandomPlayer()
  31.     local playerList = Players:GetPlayers()
  32.     if #playerList == 0 then return end
  33.  
  34.     local chosenPlayer = playerList[math.random(1, #playerList)]
  35.     chosenPlayerValue.Value = "Chosen Player: " .. chosenPlayer.Name
  36.  
  37.     if chosenPlayer.Character then
  38.         chosenPlayer.Character:MoveTo(chosenSpawn.Position)
  39.     end
  40.  
  41.     for _, player in pairs(playerList) do
  42.         if player ~= chosenPlayer and player.Character then
  43.             player.Character:MoveTo(otherSpawn.Position)
  44.         end
  45.     end
  46. end
  47.  
  48. task.wait(10)
  49. chooseRandomPlayer()
  50.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement