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

Why do I have HealthChanged Errors? [EDITED]

Asked by
woodengop 1134 Moderation Voter
9 years ago

First I Created a localscript with the code:

local plr=game.Players.LocalPlayer
local chr=plr.Character
local hm=chr.Humanoid

b=game.ReplicatedStorage.b:Clone()

hm.Health.HealthChanged:connect(function(heth)
    local changed=math.abs(hm.Health-heth)
        --]] What should I Add?
    if b then
        b.Parent=chr.Torso
    end
end)

What should I add, in order to tell if a Player lost some health?

Please respect that I am a Beginner in need of knowledge

0
You can't just set the Parent for things from replicated storage. You must use the Clone() function DewnOracle 115 — 9y
0
You said, in the title or question, their are errors. You're not telling us what the error is? If you're just asking a question about something, then you should change your Title. Anyway, if your MaxHealth = 100, then do something like if hm.Health < 100 then alphawolvess 1784 — 9y
0
kk woodengop 1134 — 9y

Answer this question