Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can I make my Game pass health script heal too?

I have this script that adds Health when they join my game is they have a certain Game pass. It works perfectly. There is one problem though when they get the health it doesn't put it at that health. As in it puts the max health there but they haven't healed yet so it is still 100 health. I was wondering how I could edit the script to put there health to 250 when it is done changing the max health. (Healing them to the max health) Script:

local gps = game:GetService("GamePassService");
local id = script:WaitForChild("GamePassID");
local Health = script:WaitForChild("ExtraHealthAmount");

game.Players.PlayerAdded:connect(function(Player)
    Player.CharacterAdded:connect(function(char) --CharacterAdded event
        char:WaitForChild("Humanoid") --Just to be safe(;
        if gps:PlayerHasPass(Player , id.Value) then
            local hum = Player.Character.Humanoid
            hum.MaxHealth = hum.MaxHealth + Health.Value
        end
    end)
end)

If you could help it would be really nice. THANKS!

1 answer

✓ Accepted answer

if am not wrong ur looking to make ur Health the same as ur MaxHealth (or no? interrupt me if am wrong)

just add

hum.Health = hum.MaxHealth

2 comments

0

Thanks, I was JUST thinking that when I got on cod!

0

lol :D

This discussion is preserved as it was. New answers, comments, and votes are closed.