So when I use the roblox spawn right its glitched and this is how…
I put the spawn point in the building but every time randomly you might spawn on the roof and I have like 21 spawns in the building and also I was testing it alone so there were no players what is the problem.
If there is something (like BasePart
s) above the SpawnLocation
, the player will spawn on it (in this case, the roof)
Another way you could do it is by this:
local Spawns = workspace.Spawns:GetChildren()
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
local RandomSpawn = Spawns[math.random(1, #Spawns)]
local HRP = Character:WaitForChild("HumanoidRootPart")
HRP.Position = RandomSpawn.Position
end)
end)