RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"Write me a script that makes a player invulnerable to damage after touching a certain part"
-- Put this script inside the part that the player should touch to become invulnerable local part = script.Parent local function makeInvulnerable(otherPart) local player = game.Players:FindFirstChild(otherPart.Parent.Name) if player then local humanoid = player.Character:FindFirstChild("Humanoid") if humanoid then humanoid.MaxHealth = math.huge humanoid.Health = math.huge wait(5) -- Change this value to the number of seconds you want the invulnerability to last humanoid.MaxHealth = 100 humanoid.Health = 100 end end end part.Touched:Connect(makeInvulnerable)