For context, I am trying to make an army based game where you control an army of subjects. I tried to take an OOP approach to making the code, which you will see below.
Everything works fine, except for when the NPCs move. I am using humanoid:MoveTo to move them to their desingated spot on every heartbeat, and a property changed signal is suppoed to fire every time it detects they move, playing an animation. The problem is, its pretty delayed, taking half a second before actualy working.
There are not many alternatives to this, as I dont want to just constantly check if they are moving or not in a heartbeat function because theres 18 subjects.
self.model.Humanoid.Running:Connect(function(speed)
if speed > 0.01 and not self.moving then
self.animations.Run:Play()
self.moving = true
end
if speed < .01 and self.moving then
self.animations.Run:Stop()
self.moving = false
end
end)
end)
(changing the if statement to a smaller or larger number does not fix the problem either.)
Help is very appreciated!