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

Character not moving to the place its supposed to when it respawns?

I've done this but its not working? no errors. not working in studio nor server?

Player.CharacterAdded:connect(function()
	Player.Character:MoveTo(GetTycoon().BasePlate.Position + Vector3.new(0,10,0))
end)

1 comment

0

GetTycoon() is a function i made that gets the player's tycoon

1 answer

Other than the fact that Player wasn't defined in the question, your problem is that the Character has not loaded yet.

You should wait until the HumanoidRootPart has loaded using the WaitForChild function, and then CFrame it.

######note: remember to use variables to keep your code clean and concise!

game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:connect(function(c)
		local h = c:WaitForChild("HumanoidRootPart")
		local target = GetTycoon().BasePlate.Position
		local offset = Vector3.new(0,10,0)
		h.CFrame = CFrame.new(target + offset)
	end)
end)

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