PcoWSkbVqDnWTu_dm2ix
Collapse Sidebar

Enabled

SpawnLocation

bool

Sets whether or not the SpawnLocation is enabled. When disabled players cannot spawn at the SpawnLocation and the SpawnLocation/AllowTeamChangeOnTouch functionality is disabled.

This property provides the most convenient way of preventing Players from spawning at a spawn.

Note, although team changing on touch using SpawnLocation/AllowTeamChangeOnTouch is disabled when Enabled is set to false, other touched events using BasePart.Touched will still fire.


Code Samples


SpawnLocation Enabled

The following sample will create a SpawnLocation in the Workspace that will become semi-transparent when it is disabled.

local spawnLocation = Instance.new("SpawnLocation", game.Workspace)
spawnLocation.Anchored = true
spawnLocation.Size = Vector3.new(5, 1, 5)
spawnLocation.Neutral = true -- anyone can spawn here
spawnLocation.Enabled = true

spawnLocation:GetPropertyChangedSignal("Enabled"):Connect(function()
	spawnLocation.Transparency = spawnLocation.Enabled and 0 or 0.5
end)

wait(5)
spawnLocation.Enabled = false -- transparency = 0.5