say i have a spawn point, and i reset, i want to spawn at a part, how do i do that?
You use a spawn point block, this is not exactly a scripting matter but more or less locating the spawn point block.
Go to models in the studio top bar tab, then just follow this image:
Just to add to @index_l, I believe if there are more than one spawn point with Neutral
and Enabled
on, the game will randomly select one of those spawn points to spawn you at in your case, so you could put spawn poinst where you want with those properties on and it should do what you want
Let’s say for Instance we don’t use Spawn Locations
This is what you could do:
-
Put all of your SpawnParts inside a Folder, that way it’s easy to find
-
Get all the SpawnParts using the
GetChildren()
function -
Detect when a Character Model gets added using the
CharacterAdded
Event, then spawning him/her to a random spawn
Put this inside ServerScriptService
:
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
local HRP = Character:WaitForChild("HumanoidRootPart")
local SpawnPoints = workspace.SpawnPoints:GetChildren()
local RandomSpawn = SpawnPoints[math.random(1, #SpawnPoints)]
print(RandomSpawn)
if RandomSpawn then
HRP.Position = RandomSpawn.Position
end
end)
end)