Trying to make an npc accelerate towards player. Doesn’t accelerate.
local Humanoid = script.Parent.Zombie
Humanoid.WalkSpeed = 8
local function Moved()
if Humanoid.MoveDirection ~= Vector3.new(0,0,0) then
Humanoid.WalkSpeed = Humanoid.WalkSpeed*2
else
Humanoid.WalkSpeed = 8
end
end
Humanoid:GetPropertyChangedSignal("MoveDirection"):Connect(Moved)
I think you have to define the humanoid first. It has been about 3 months since I last scripted so I cant quite remember, but you have to define the humanoid in the zombie. there are plenty of things on YouTube about humanoids.