local healthBoost = script.Parent local active = true local function SteppedOn (otherPart) if active = true then parent = otherPart.Parent if game.Players:GetPlayerFromCharacter(parent) then parent.Humanoid.Health = parent.Humanoid.MaxHealth active = false wait(5) active = true end end healthBoost.Touched:connect(SteppedOn)
Here is the full code for the "healthBoost" thing I'm doing, and I'm trying to make it turn off for a specific amount of time after use, I've tried arranging it in so many ways, and it just won't work?? I need some help. It works fine without the active = true and active = false stuff, so can someone help me find out what I'm doing wrong?
local healthBoost = script.Parent local active = true local function SteppedOn(otherPart) if active == true then --or it could be 'if active then' parent = otherPart.Parent --Character if game.Players:GetPlayerFromCharacter(parent) then parent.Humanoid.Health = parent.Humanoid.MaxHealth active = false wait(5) active = true end end end -- WE LACK 1 END healthBoost.Touched:connect(SteppedOn)
I thought it's something else .. But It's just a Heal Pad or button :)