-- Configuration local gracePeriod = 5 -- seconds
-- For newly joining players Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character) character.Humanoid.HealthChanged:Connect(function(health) if health <= 0 then applyGracePeriod(player) end end) end) end) If you prefer to use a LocalScript, place it in StarterScripts or StarterPlayerScripts. Keep in mind that effects like invincibility usually should be handled server-side for consistency and security. grace script roblox
-- Get the local player local player = Players.LocalPlayer local character = player.Character -- Configuration local gracePeriod = 5 -- seconds
-- Connect to the Humanoid's HealthChanged event for _, player in pairs(Players:GetPlayers()) do player.CharacterAdded:Connect(function(character) character.Humanoid.HealthChanged:Connect(function(health) if health <= 0 then applyGracePeriod(player) end end) end) end grace script roblox
-- Services local Players = game:GetService("Players") local RunService = game:GetService("RunService")