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

Script Only Teleportating one player?

The goal is the have all the players teleport to random pads in the map and they each get there own pad, the issue is, when the script runs, only one player gets teleported to the pads. Main script

--Round Variables
local inttime = 30
local gametime = 110

--Round Objects
local status = game.ReplicatedStorage.Status
local players = game.Players:GetChildren()
--Main
while wait() do
	for i=inttime,1,-1 do
		game.ServerScriptService.FreeForAll.Disabled = true
		wait(1)
		status.Value = "int"
	end
	for i=gametime,1,-1 do
		wait(1)
		status.Value = "ffa"
		game.ServerScriptService.FreeForAll.Disabled = false
		end
	end

FreeForAll Script

players = game.Players:GetChildren()
map = game.Workspace.Map
pads = game.Workspace.Pads

while wait() do
	for i, player in pairs(game.Players:GetPlayers()) do
    	player.Character.Torso.CFrame = pads:findFirstChild(i).CFrame
		print("teleported")
		wait(120)
	end
end

Thanks

1 answer

✓ Accepted answer

In your second script, you put the wait in the wrong spot. You put the wait(120) in the loop which teleports all the players, so it teleports them one at a time.

Just move the wait outside that loop and you'll be fine.

players = game.Players:GetChildren()
map = game.Workspace.Map
pads = game.Workspace.Pads

while wait() do
    for i, player in pairs(game.Players:GetPlayers()) do
        player.Character.Torso.CFrame = pads:findFirstChild(i).CFrame
        print("teleported")
    end
    wait(120) --// Moved
end

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