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

Why isnt this teleport script working?

I want players to spawn on certain parts of a map if they are on certain teams. script:

if plr.TeamColor == game.Teams["Sentinel"].TeamColor then 
target = Vector3.new(48.487, 35.508, 50.1) --Replace those numbers with the desired position!
for i, v in pairs(game.Players:GetChildren()) do 
v.Character.Torso.CFrame = CFrame.new(target + Vector3.new(0, i * 5, 0)) -- Adds an offset of 5 to each player teleported.
end

if plr.TeamColor == game.Teams["Atlas"].TeamColor then 
	target = Vector3.new(-59.08, 33.905, -111.415) --Replace those numbers with the desired position!
for i, v in pairs(game.Players:GetChildren()) do 
v.Character.Torso.CFrame = CFrame.new(target + Vector3.new(0, i * 5, 0)) -- Adds an offset of 5 to each player teleported.
end

3 comments

0

Output?

0

it doesnt say anything

0

You did NOT add all the 'end''s for the Chunks, from the looks of the code.

1 answer

✓ Accepted answer
if plr.TeamColor == game.Teams["Sentinel"].TeamColor then 
target = Vector3.new(48.487, 35.508, 50.1) --Replace those numbers with the desired position!
for i, v in pairs(game.Players:GetChildren()) do 
v.Character.Torso.CFrame = CFrame.new(target + Vector3.new(0, i * 5, 0)) -- Adds an offset of 5 to each player teleported.
end
end

if plr.TeamColor == game.Teams["Atlas"].TeamColor then 
    target = Vector3.new(-59.08, 33.905, -111.415) --Replace those numbers with the desired position!
end
for i, v in pairs(game.Players:GetChildren()) do 
v.Character.Torso.CFrame = CFrame.new(target + Vector3.new(0, i * 5, 0)) -- Adds an offset of 5 to each player teleported.
end
end

You forgot to add some ends in your script.

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