RespawnLocation not always working

I have multiple Spawn Locations on my map.
The player will spawn depending on a variable CFrame, so I put this inside server / PlayerAdded:

local SpawnLocation = Map:WaitForChild('Lot' .. NumLot).SpawnLocation
Player.RespawnLocation = SpawnLocation

But for some reason, sometimes the player is spawning on different SpawnLocation.
What am I missing?

If the SpawnLocations have the same name, they will be teleported to a different one. Maybe rename them to SpawnLocation1, SpawnLocation2, etc.

Yea I think so if you name SpawnLocation differently the problem will be solved.

I did:

… and I changed the code (var NumLote is always 07):

local SpawnLocation = Mapa.Lotes:WaitForChild('Lote' .. NumLote):WaitForChild("SpawnLocation" .. NumLote)
print(SpawnLocation) --> SpawnLocation07
Player.RespawnLocation = SpawnLocation

But each time I run, it’s spawning on a different lot (08, 04, 05, etc…)

Go into the spawn location and make sure the Netural property is unticked, so it doesn’t move your player to random spawn each time.

Is NumLot random? Or is it a fixed number?

As stated this only works upon player respawn.

???
So what do I have to do to spawn the player on a specific spawn location?

I believe you’d have to either use teams or teleport them to the spawn location.

This makes the player always spawn in one place (which is not any spawnlocation I have on the map)

I discovered the problem: inside my script I had Player.CharacterAdded:Wait() before setting the SpawnLocation, so the player was already spawned before setting the location, which caused the confusion.
Thank you all.

2 Likes