Minor = script.Parent Health = script.Parent WalkSpeed = script.Parent if Health <= 900 then script.Parent.Minor.WalkSpeed = 39 end
i'm trying to make a script that makes it so when an NPC hits low health it goes fast but for some reason it doesn't work when i set it to the said value that is supposed to make it go fast when the health reaches that value also i named the Humanoid "Minor" so don't get confused on why it says minor = script.parent lol
What? Why are all your variables script.Parent
...
if script.Parent.Minor.Health <= 900 then script.Parent.Minor.WalkSpeed = 39 end
This is enough, no need for those variables. If you want it to constantly check how much health it has then...
while true do wait() if script.Parent.Minor.Health <= 900 then script.Parent.Minor.WalkSpeed = 39 end end
dont forget your locals and the script must only be in the Model unless if you know how to change this code.
local Humanoid = script.Parent local Health = Humanoid.Health local WalkSpeed = Humanoid.WalkSpeed if Health <= 900 then WalkSpeed = 39 end