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

Teleport all players to their own spawn?

SERVER

	for i,v in pairs(game.Players:GetChildren()) do
		for b,j in pairs(workspace[currentMap]:GetChildren()) do
			if j.Name == 'spawn' then
				j.Name = v.Name.. "'s Spawn"
			end
		end
	end

LOCAL

game.Players.LocalPlayer.Torso.CFrame = workspace["GreenMap"]:FindFirstChild(game.Players.LocalPlayer.Name.. "'s Spawn")

I tried this but I can't get it to work properly.

1 comment

0

Can you tell what error did you get?

1 answer

#What you did wrong? You need to teleport the player to the part's CFrame, not the part.


#Values When you say CFrame = part you mean to change the CFrame to an object. Which will obviously error. You should instead say: CFrame = part.CFrame because part.CFrame is a CFrame value which changes the CFrame value into another CFrame value. Think about it like this:

--Pretend the numbers are the different values
print(1==1) --true
print(2==2) --true
print(1==3-2) --true; 3-2 could be like part.CFrame.

#Final Product

game.Players.LocalPlayer.Torso.CFrame = workspace["GreenMap"]:FindFirstChild(game.Players.LocalPlayer.Name.. "'s Spawn").CFrame


Hope it helps!

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