Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Will my health script work?

Asked by 10 years ago

Basically, if you pick up the health pickup, it'll make your MaxHealth 200 and will give you 100 health. So if you have 25 health, the next time you pick up the health, it gives you 125. Would this script work? And if you pick it up again, it doesn't give you another 100 health. So if the max health is 200 already, the next time you pick it up it's not going to be 300.

wait()
script.Sound1.Parent = script.Parent.Torso
wait(0.1)
script.Sound2.Parent = script.Parent.Torso
script.Parent.Torso.Sound1:Play()
if (script.Parent.Torso:findFirstChild("sparkle") == nil) then
local s = script.sparkle:clone()
s.Name = "sparkle"
s.Parent = script.Parent.Torso
s.Enabled = true
end
for i = 1,1 do
wait(0)
script.Parent.Humanoid.Health = script.Parent.Humanoid.Health + 100
script.Parent.Humanoid.MaxHealth = scrip.Parent.Humanoid.MaxHealth + 100
end
if script == nil then return end
if MaxHealth == 200 then return end
script.Parent.Torso.sparkle:Remove()
script.Parent.powerup:Remove()
script.Parent.Torso.Sound1:Remove()
script.Parent.Torso.Sound2:Remove()
script:Remove()

Answer this question