Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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!

1 comment

0

Remember just a reference! Figure the rest for yourself ;)

This discussion is preserved as it was. New answers, comments, and votes are closed.