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

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

Asked by 9 years ago

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!

Marked as Duplicate by Goulstem, EzraNehemiah_TF2, Redbullusa, and adark

This question has been asked before, and already has an answer. If those answers do not fully address your question, then please ask a new question here.

Why was this question closed?

1 answer

Log in to vote
1
Answered by 9 years ago

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
0
Thanks, I was JUST thinking that when I got on cod! TixyScripter 115 — 9y
0
lol :D Kapitanovas 0 — 9y
Ad