Fixing this with scripting seems annoying since the way I would move players is with MoveTo() but then using that would make them spawn on the roof too. CFrame would be great but then I run the risk of players spawning inside each other.
Any ideas?
UPDATE: this only happens when I move the spawns -500 studs or lower. I need them down here so my lobby doesn’t clip with the maps. Can’t move the maps up because I foolishly made some cutscenes w/ CFrame so their positions are pretty much permanent unless I to redo them.
This usually happens because spawning seems to check for collisions so if for example you have an invisible part above the spawn parts the spawning will put the player above the invisible part, but this shouldn’t happen if the invisible part’s cancollide property is false, and especially shouldn’t happen if there isn’t any invisible part or any part in the way at all. But I do know spawning will make checks to spawn players at the highest safe area when possible, this is the reason why players will spawn on top of eachother’s heads.
My solution would be to have a script check the player’s location a split second after spawning and teleport the player to the spawn using CFrame (with a random offset) if they somehow spawned outside of the intended area due to this issue or if they got flung somehow which ive seen happen in some games.
I’ve grown out of using SpawnPoints, I find CFraming the character on spawn is much better as it won’t position the character on top of something.
Example:
local Players = game:GetService("Players")
local Spawns = game:GetService("Workspace"):FindFirstChild("Spawns"):GetChildren()
Players.PlayerAdded:Connect(function(p)
p.CharacterAdded:Connect(function(char)
wait() --Won't CFrame the Character if this ain't here.
local Torso = char:FindFirstChild("Torso")
if not Torso then --Incase R15
Torso = char:FindFirstChild("Lower Torso")
end
local C_Spawn = Spawns[math.random(1, #Spawns)]
Torso.CFrame = CFrame.new(C_Spawn.Position) + Vector3.new(0, 2.5, 0)
end)
end)
Plus it doesn’t spawn the character with a ForceField.
Also, as an update, this only happens when I move the spawns -500 studs or lower. I need them down here so my lobby doesn’t clip with the maps. Can’t move the maps up because I foolishly made some cutscenes w/ CFrame so their positions are pretty much permanent unless I to redo them.
The risk of players spawning inside each-other isn’t a big problem. It depends on the amount of spawns you have placed in the lobby, and they can be extremely small. From my knowledge if a player is CFramed on another player they just get pushed out of the way of each-other.
Plus all you’d need to do is set the Vector3.new(0, 2.5, 0) in the script to a higher number so they fall when they spawn. Thus basically removing the risk of being CFramed directly into a character.
It is a problem. I’ve done the CFrame thing before in this exact game and that happened way more often than I’d like.
It’s not as easy as adding to the Vector3 unless I keep track of everyone that’s standing over a spawn. I’d really like to not add unnecessary code to my already large game.
I appreciate the help, but unfortunately I can’t use CFrame.
Perhaps, you can turn off collision for players while they’re in the lobby, and you can turn them back on once they’re getting teleported to the map, if you wish.
I know I was replying to Wingz_P, and it might be useful to anyone that reads it because a lot of people check for the Torso when they can just do HumanoidRootPart.