PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

Duration

SpawnLocation

int

The length of time, in seconds, that a ForceField will be applied to a Player character spawning at this SpawnLocation. If Duration is zero, the ForceField is never created, and it will not trigger the Instance/DescendantAdded or Instance/ChildAdded events.

This default value of this property is 10 seconds.

The duration feature allows developers to easily give Players protection from ‘spawn killing’ which can be a frustrating experience for players. Note, ForceFields will only protect users from Explosions and Weapons that use Humanoid/TakeDamage to deal damage or otherwise check for a ForceField.


Code Samples


SpawnLocation ForceField

This sample will create a neutral SpawnLocation in the Workspace that’ll give players spawning a ForceField for 20 seconds.

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.Duration = 20 -- ForceField duration 20s