Ok, instead of making you guys have a very hard time with an extremely difficult way of making damage resistance, I just want to know how to change the player's health&MaxHealth. Here's what I'm asking: say a player steps on an armor pad, the player has 20hp and a max health of 100 (the average) how do I make it so that for (insert random amount of time), they actually have 40 HP and max health of 200 HP. Then, if they take damage (say they're at 5 HP/200) their hp goes back to 2.5 HP out of 100.
so the script multiplies their health by 2 and after (insert the amount of time) the hp divides by 2 (back to normal)
Here's how I would do it:
local armorPad = script.Parent --gets your armor pad (assuming the script is under it) local armorOn = false --just a debounce armorPad.Touched:Connect(function(hit) local humanoid = hit.Parent:FindFirstChild("Humanoid") --gets humanoid from hit (the one who that armorPad) if humanoid and not armorOn then --checks for humanoid and debounce armorOn = true --sets debounce to true humanoid.Health *= 2 --doubles health humanoid.MaxHealth *= 2 --doubles max health wait(10) --waits 10 seconds before v armorOn = false --setting debounce to false humanoid.Health /= 2 --halfs health humanoid.MaxHealth /= 2 --halfs max health end end
Resources that may help: https://developer.roblox.com/en-us/articles/Debounce https://developer.roblox.com/en-us/api-reference/event/BasePart/Touched https://developer.roblox.com/en-us/api-reference/class/Humanoid
idk try this
stuff:Connect(function(player) -- replace stuff with the function that will get it to start player.Health = player.Health * 2 player.MaxHealth = player.MaxHealth * 2 end)