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?
xMagmaDev
(Terrainny)
August 29, 2021, 3:28pm
2
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…)
ItsSovxy
(Sovxy)
August 29, 2021, 5:11pm
5
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.
Abcreator
(Abcreator)
August 29, 2021, 5:12pm
6
rogeriodec_games:
NumLot
Is NumLot random? Or is it a fixed number?
Abcreator
(Abcreator)
August 29, 2021, 5:13pm
7
rogeriodec_games:
Player.RespawnLocation
As stated this only works upon player respawn.
???
So what do I have to do to spawn the player on a specific spawn location?
Abcreator
(Abcreator)
August 29, 2021, 5:17pm
9
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