Do you mean that the spawn locations gets spawned by scripts that can be spawned only for a certain player and not others or you make a lot of different spawn locations that can be spawned only for a certain player and not others?
In short, do you mean that you spawn Spawn Locations by scripts for only one player or you make a lot of spawn locations for only one player.
I believe something like this would work, if I understand your request.
local Players = game:GetService('Players')
local SpawnLocations = workspace.SpawnLocations:GetChildren() --get an array of possible spawns
Players.PlayerAdded:Connect(function(Player)
Player.RespawnLocation = table.remove(SpawnLocations, math.random(#SpawnLocations)) --set their RespawnLocation to a random spawn
end)
Players.PlayerRemoving:Connect(function(Player)
table.insert(SpawnLocations, Player.RespawnLocation) --insert the leaving player's RespawnLocation back into the array
end)
This works because table.remove returns the element it removed so we can simply use that to remove from the array and set their RespawnLocation at the same time.
When a player gets added to the game, a spawnlocation gets cloned somewhere. This should be the spawnlocation of the player, but sometimes the player spawns on someone else’s spawnlocation.