-- Prevents health reduction. -- Character will survive explosions. -- *Will not work completely if health is set to 0. -- *Weapon will not stay attached if in an explosion. time = 10 -- Invincible for n seconds. function onPlayerRespawned(newPlayer) local health = newPlayer.Character.Humanoid.Health local maxhealth = newPlayer.Character.Humanoid.MaxHealth local s = Instance.new("Script") -- I could have used a coroutine to do this part, but there's a bunch -- of dirty work that I didn't feel like getting into. s.Source = [[ print("Invunerable") local character = script.Parent function Save(object, match, copy, parent) if character == nil then return end local animate = character.Animate cani = animate:Clone() if object == match then copy.Parent = parent parent.ChildRemoved:connect(function(property) Save(property, copy, copy:Clone(), parent) end) animate.Parent = nil cani.Parent = character end end -- Save Joints! -- local head = character:FindFirstChild("Head") if head~=nil then local weld = head:FindFirstChild("HeadWeld") if weld~=nil then local Cweld = weld:Clone() head.ChildRemoved:connect(function(property) Save(property, weld, Cweld, head) end) end end local torso = character:FindFirstChild("Torso") if torso~=nil then local neck = torso:FindFirstChild("Neck") if neck~=nil then local Cneck = neck:Clone() torso.ChildRemoved:connect(function(property) Save(property, neck, Cneck, torso) end) end local lhip = torso:FindFirstChild("Left Hip") if lhip~=nil then local Clhip = lhip:Clone() torso.ChildRemoved:connect(function(property) Save(property, lhip, Clhip, torso) end) end local rhip = torso:FindFirstChild("Right Hip") if rhip~=nil then local Crhip = rhip:Clone() torso.ChildRemoved:connect(function(property) Save(property, rhip, Crhip, torso) end) end local lsho = torso:FindFirstChild("Left Shoulder") if lsho~=nil then local Clsho = lsho:Clone() torso.ChildRemoved:connect(function(property) Save(property, lsho, Clsho, torso) end) end local rsho = torso:FindFirstChild("Right Shoulder") if rsho~=nil then local Crsho = rsho:Clone() torso.ChildRemoved:connect(function(property) Save(property, rsho, Crsho, torso) end) end end --------------------- local h = character:FindFirstChild("Humanoid") if h~=nil then h.MaxHealth = (2^30) h.Health = (2^30) end function healthChanged(property) if property == "Health" then character.Humanoid.Health = (2^30) elseif property == "MaxHealth" then character.Humanoid.MaxHealth = (2^30) end end function onChanged(property) if property.className == "Hat" then wait() local head = character:FindFirstChild("Head") if head~=nil then local weld = head:FindFirstChild("HeadWeld") if weld~=nil then local Cweld = weld:Clone() head.ChildRemoved:connect(function(property) Save(property, weld, Cweld, head) end) print("Hat Success") end end end end character.ChildAdded:connect(onChanged) character.Humanoid.Changed:connect(healthChanged) ]] s.Parent = newPlayer.Character print("Inserted") wait(time) s.Parent = nil print("Removed") newPlayer.Character.Humanoid.Health = health newPlayer.Character.Humanoid.MaxHealth = maxhealth end function onPlayerEntered(newPlayer) newPlayer.Changed:connect(function (property) if (property == "Character") then onPlayerRespawned(newPlayer) end end) end game.Players.PlayerAdded:connect(onPlayerEntered)