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

This script teleports everyone to the same block for some reason, can someone help me fix it?

I want each player to be teleported to a different teleporter.

local plrs = game.Players:GetChildren() wait(70) local teleports = game.Workspace.Teleports:GetChildren() for i,v in pairs(game.Players:GetPlayers()) do local char = v.Character for i,v in pairs(game.Workspace.Teleports:GetChildren()) do

    char:FindFirstChild("HumanoidRootPart").Position = v.Position

end end

1 comment

0

Could you put ALL the lua into the lua block? I can barely read it.

3 answers

✓ Accepted answer

It's because you're setting the player's position to the same teleporter at the same time. To make it so it's a different teleporter you would make it so it teleports the player to a teleporter using the index assuming theres the same amount of teleporters as players.

local plrs = game.Players:GetChildren() 
wait(70) 
local teleports = game.Workspace.Teleports:GetChildren() 

for i,v in pairs(game.Players:GetPlayers()) do 
	local char = v.Character 
	char:FindFirstChild("HumanoidRootPart").Position = teleports[i].Position
end
plrs = game.Players:GetChildren()
wait(70)
tps = workspace.Teleports:GetChildren()
for i=1,#plrs do
	for a=1,#tps do
		char = plrs[i].Character
		char:MoveTo(tps[i].Teleport.CFrame.Position)
	end
end

You can use :MoveTo() to teleport Model.

I don't know why you put line 1 and line 3

plrs = game.Players:GetChildren()
local teleports = game.Workspace.Teleports:GetChildren()

that doesn't do anything.

Here is script

wait(70) 

for i,plrs in pairs(game.Players:GetPlayers()) do 
    local char = plr.Character 
    for i,teleports in pairs(workspace.Teleports:GetChildren()) do
        char:MoveTo(teleports.Position)
    end
end

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