RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"make a save zone"
-- server script to create a safe zone local safezone = game.Workspace.SafeZone -- Assuming there's a part named SafeZone local playersInZone = {} local function onEnterSafeZone(otherPart) local player = game.Players:GetPlayerFromCharacter(otherPart.Parent) if player then playersInZone[player.UserId] = true -- Any additional logic for when a player enters the safe zone end end local function onExitSafeZone(otherPart) local player = game.Players:GetPlayerFromCharacter(otherPart.Parent) if player then playersInZone[player.UserId] = nil -- Any additional logic for when a player exits the safe zone end end safezone.Touched:Connect(onEnterSafeZone) safezone.TouchEnded:Connect(onExitSafeZone) -- To check if a player is in the safe zone elsewhere in your code: -- local isPlayerSafe = playersInZone[player.UserId] or false