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

why does my npc not get faster when it's at half health?

Asked by 3 years ago
character = script.Parent -- The npc
humanoid = character.Major -- Change this to the humanoid name
yellowzone = humanoid.MaxHealth/2 -- for if the npc health is at half
humanoid.Changed:Connect(function()
    if humanoid <= yellowzone then -- if the health is 1/2
        humanoid.WalkSpeed = 40 -- change speed
    elseif humanoid > yellowzone then -- if it's above half health
        humanoid.WalkSpeed = 20 -- normal speed
    end
end)


since i didn't want to make it so if the health amount is at a specific number it gets faster i wanted to make it so if it's at half or 50% hp it'll change speed but it doesn't seem to work how can i fix this?

0
try putting on line 5 .health next to humanoid SitaruDaniel 44 — 3y
0
thank you it worked i'm kinda forgetful when it comes to this kind of stuff and i'm still new to coding dylancrazy88 20 — 3y

Answer this question