Before you say use a spawn location let me get you up to speed.
I basically have a level game and each level have a spawn point.
So when you when die in one level you went to another.
I then fixed that.
So now I need to make sure that they spawn at level 1.
So I made this script.
player.Character:WaitForChild("HumanoidRootPart").CFrame = game.workspace.Lobby.InvisiblePart.CFrame
It doesn’t work.
It prints the statements and has no error.
June 11, 2021, 1:16pm
Maybe try like this:
You need to yield a bit to overide the default spawn system. As seen from the documentation on character added:
wait() or stepped wait should work.
I believe this will be solution, found from the character added documentation
local RunService = game:GetService("RunService")
-- Wait a brief moment before teleporting, as Roblox will teleport the
-- player to their designated SpawnLocation (which we will override)
I also tested within studio should work, even a normal wait() works.
To debug add a CFrame changed property, it’ll see where and when the character has been teleported by the…
char:WaitForChild("HumanoidRootPart").CFrame = game.Workspace.Lobby.InvisiblePart.CFrame
Add a print after you tp the player?
Edit: nvm theres already a solution
This works but how could you make so it only does it when you 1st spawn in the game and not when you die?
If anyone has another solution that would be nice.
You haven’t even tried adding a yield to your script yet?
local part = script.Parent
local char = player.Character or player.CharacterAdded:Wait()
wait()--any yield should do
char.HumanoidRootPart.CFrame = part.CFrame