If you want the player to be invincible (god mode) add this script into the humanoid:
2 | script.Parent.Health = script.Parent.MaxHealth |
Make sure that script is disabled. In another script, have a way to toggle it. For demonstration perposes, I'll use a part that, when it's touched, toggles god mode
01 | script.Parent.Touched:Connect( function (hit) |
02 | if hit.Parent:FindFirstChild( "Humanoid" ) then |
03 | local hum = hit.Parent:FindFirstChild( "Humanoid" ) |
04 | if hum:FindFirstChild( "GodModeScript" ) then |
05 | local god = hum:FindFirstChild( "GodModeScript" ) |
06 | if god.Disabled = = true then |
08 | elseif god.Disabled = = false then |