I have all the animations working BUT there is a problem. Roblox wants me to put end at the end of each “if false then”. I’m trying to avoid this so it results in: If NPC speed is greater than 8, play the running animation, but if the speed is currently something like 4, it will check if it has speed less than 1, if that’s the case it will play the idle animation because it has stopped moving. Finally, after this, it will check if speed is between 1-8, and if it is, it will play the walking animation.
When I do place the ends of “if false then”, it will simply break the animations and none of it will work.
Heres the script(s).
Animation according to speed (problem i have)
local Animation = game.Workspace.MIKKLE2.Humanoid.Animator
local Mikkle = Animation.Parent.Parent
local Humanoid = script.Parent.Humanoid
local RunAnim = Humanoid.Animator.RunAnim
local IdleAnim = Humanoid.Animator.IdleAnim
local WalkAnim = Humanoid.Animator.WalkAnim
-- animation cache
local b = Mikkle.Humanoid:LoadAnimation(IdleAnim)
local a = Mikkle.Humanoid:LoadAnimation(RunAnim)
local c = Mikkle.Humanoid:LoadAnimation(WalkAnim)
Mikkle.Humanoid.Running:Connect(function(speed)
if speed > 8 then
a:Play()
b:Stop()
c:Stop()
if false then
if speed < 1 then
b:Play()
a:Stop()
c:Stop()
if false then
if speed > 1 then
c:Play()
b:Stop()
a:Stop()
end
end
end
end)
Change speed at random times
local WlkSpeed = game.Workspace.MIKKLE2.Humanoid
while true do
WlkSpeed.WalkSpeed = 9
wait(5)
WlkSpeed.WalkSpeed = 6
wait(5)
WlkSpeed.WalkSpeed = 12
wait(8)
WlkSpeed.WalkSpeed = 15
wait(12)
WlkSpeed.WalkSpeed = 0
wait(2)
end
Any help is appreciated