Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I have 10 players teleport at 5 random positions?

Asked by 10 years ago

It seems that Lua is being a pain in a butt at me lately, which is why I need an answer. This script is in the StarterGui folder in the explorer under a frame.

Hmm = 0.4
Derp = Workspace.GUIPart.SurfaceGui.Frame.TextLabel

for i = 1.0,0,-0.1 do
    script.Parent.BackgroundTransparency = tostring(i)
wait()
end

Derp.Text = "Please Wait For Next Round..."
wait(2)
             ---- Position Code Here
wait(3)
for i = 0,1.0,0.1 do
    script.Parent.BackgroundTransparency = tostring(i)
wait()
end
end

The problem I am dealing with is the position. I want 10 players to randomly teleport to any 5 random spots. But I just don't know how to pull that off. Can anyone help me?

1 answer

Log in to vote
0
Answered by 10 years ago

I hate just giving it away but here :)

local players = game.Players:GetPlayers()

for i = 1,10 do
local randomplyr = players[math.random(1, #players)]
local char = randomplyr.Character
char.Torso.Position = CFrame.new(math.random(), math.random(), math.random())
end

I can not guarantee it won't teleport the same person twice. Remember that this is only to be used as a reference and should not be used as the actual script as it may not fit your needs!

0
Remember just a reference! Figure the rest for yourself ;) joshuatodd21 40 — 10y
Ad

Answer this question