Custom Spawnpoint

I want the player to be able to spawn at certain locations, based on their leaderstat data.

The method I have always relied on is

player.CharacterAdded:Connect(function(charV)
    wait(.1)
    charV:WaitForChild("HumanoidRootPart").CFrame = spawnPoint.CFrame+Vector3.new(0,5,0)
end)

Without the wait statement, changing the CFrame of HumanoidRootPart doesn’t actually move the unloaded character.

Recently, I discovered p.CharacterAppearanceLoaded, which fires only after all parts HAVE loaded. This was working great, until the coincidental engine slowdown that is occurring right now. Due to the player’s avatar items not loading, this event no longer fires and I have to move back to the original race condition.

Is there a method to achieve this custom spawn point more efficiently?

2 Likes

Yes, there’s definitely a better way of scripting this custom spawn point more efficiently…
You can use PlayerAdded event and check for the Character that loaded in using CharacterAdded event and your script should look somewhat like this:

game:GetService("Players").LocalPlayer.PlayerAdded:Connect(function(Player)
       Player.CharacterAdded:Connect(function(Character)
              Character.HumanoidRootPart.Position = spawnPoint.Position+Vector3.new(0,5,0)
       end)
end)

You can just make normal spawnpoints but rename them.
like If they hit a certent level on the leader board just tell the script they spawn there from now on

(assuming u already defined the player)

local spawn1 = game.Workspace.spawn
local spawn2 = game.Workspace.spawn2

if player.leve1.Value >= 100 then
    player.Character.HumanoidRootPart.CFrame = spawn2.CFrame
else
    player.Character.HumanoidRootPart.CFrame = spawn1.CFrame
end

1 Like