-
What do you want to achieve? Keep it simple and clear!
a run system, with stamina and animations -
What is the issue? Include screenshots / videos if possible!
the animations keep bugging out, for some reason -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
yes, i have tried multiple solutions, and nothing worked
what code are you using to play the walk animations
also maybe the animation length has to match the default walk animation length of 1 second
the code im using to play the animations i here
rs.Heartbeat:Connect(function(DeltaTime)
if walk.IsPlaying then
print("Walk")
end
if run.IsPlaying then
print("Run")
end
if humanoid.MoveDirection.Magnitude == 0 then --if the movedirection is equal to 0 then the following will happen;
moving = false
elseif humanoid.MoveDirection.Magnitude > 0 then --if the movedirection is greater than 0 then the following will happen;
moving = true
end
if (rootpart.CFrame.LookVector:Dot(humanoid.MoveDirection)) <= -0.65 then
run:AdjustSpeed(-0.85)
walk:AdjustSpeed(-1)
runningback = false
else
runningback = true
run:AdjustSpeed(1)
walk:AdjustSpeed(1)
end
if running then
if stamina > 0 then
stamina = stamina - staminaloss * DeltaTime
else
exhausted = true
end
elseif stamina < 100 then
stamina = stamina + staminaloss * DeltaTime
if stamina > RunRefresh then -- we can now run again!
exhausted = false
end
end
staminabar.Size = UDim2.new(stamina/maxsize,0,1,0)
if moving then
if running and not exhausted then
walk:Stop()
if not run.IsPlaying then
run:Play(.2)
end
if runningback then
humanoid.WalkSpeed = sprintspeed * 0.85
else
humanoid.WalkSpeed = sprintspeed
end
else
run:Stop()
if not walk.IsPlaying then
walk:Play(.2)
end
humanoid.WalkSpeed = walkspeed
end
else
run:Stop(.2)
walk:Stop(.2)
end
end)
it may be bad but i dont know what went wrong
I figured out the issue
it was that there already was an animator instance
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.