RB-004
Roblox anti-fall void reset script
Respawns players who fall below the map so they do not fall forever.
- Script type
- Script
- Where it goes
- ServerScriptService
- Category
- Admin and safety
For your own game in Roblox Studio. Not for use in other people's games.
The code
-- Anti-fall: if a player drops below VOID_HEIGHT, they respawn.
local VOID_HEIGHT = -100 -- the Y height under your map. Pick a number lower than the lowest part.
local CHECK_EVERY = 0.5 -- seconds between checks
local Players = game:GetService("Players")
-- Roblox deletes anything below this height anyway (default -500).
-- Making sure our line is above it:
if VOID_HEIGHT <= workspace.FallenPartsDestroyHeight then
warn("VOID_HEIGHT should be higher than workspace.FallenPartsDestroyHeight")
end
while true do
for _, player in Players:GetPlayers() do
local character = player.Character
local humanoid = character and character:FindFirstChildOfClass("Humanoid")
local root = character and character:FindFirstChild("HumanoidRootPart")
if humanoid and root and humanoid.Health > 0 and root.Position.Y < VOID_HEIGHT then
humanoid.Health = 0 -- the player respawns at their spawn or checkpoint
end
end
task.wait(CHECK_EVERY)
endHow to set it up
- Look at the lowest part of your map. In the Properties window, note its Position Y value.
- Add a Script to ServerScriptService and paste the code.
- Set VOID_HEIGHT to a number a bit lower than that Y value, for example 50 studs lower.
- Play, walk off the edge, and check that you respawn.
Change it
- Without this, players fall until Roblox removes them at FallenPartsDestroyHeight, which is -500 by default. That takes a while.
- Because the player dies, it works with the Checkpoint system script. They come back at their checkpoint.
- A big map with parts at many heights may need a kill part instead. This script uses one height for the whole map.
More in Admin and safety
More Roblox tools
- Shirt and pants templatesFree Roblox clothing templates to download: hoodies, jerseys, jeans, joggers and more.
- Robux tax calculatorWork out what you receive after the marketplace fee, or what to charge.
- Robux to USD calculatorConvert earned Robux to dollars at a DevEx rate you can edit.
- Shirt and pants template makerColour each panel of the 585×559 clothing template and download it.
- Username generatorGenerate usernames that fit the 3–20 character rule.