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

How can I teleport all players who enter my world to a certain location?

I have been trying to make this work in a normal script, the code executes the "Moving to #1" print, but it does not actually move the character, and I have no idea why that is. The path to the SpawnPoint is correct.

--Waiting for players to load
while #game.Players:GetPlayers() == 0 do
	wait()
end

--Teleports player to #1
for _, player in pairs(game.Players:GetPlayers()) do	
	
	--prints out amount of players
	print(#game.Players:GetPlayers())
	
	local character = player.Character or player.CharacterAdded:Wait()
	local SpawnPoint = game.Workspace.Plots.Plot_1.SpawnPoint
	
	--If Character is loaded
	if (character) then
		print("Moving to #1")
		
		--teleports player to SpawnPoint
		character.PrimaryPart.CFrame = SpawnPoint.CFrame
	end		
end

any ideas?

1 answer

✓ Accepted answer

**Try this **

character.Torso.CFrame = SpawnPoint.CFrame

1 comment

0

My problem was the fact some of the bricks was not loaded yet. But nevertheless, my problem got solved. Not by this, but I guess this could work aswell. I'll accept your answer.

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