- What do you want to achieve? Keep it simple and clear!
– Animation stopping whenever the player stops running (or walking)
-
What is the issue? Include screenshots / videos if possible!
*btw ignore the bad quality of this because im in a hurry so no OBS rn
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
– Yeah… nothing works really…
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local function sprint(active)
if isTired then return end
if active then
hum.WalkSpeed = 24
for i,v in pairs(hum:GetPlayingAnimationTracks()) do
v:Stop()
end
hum.Animator:LoadAnimation(char:WaitForChild("Animate").run.RunAnim):Play()
else
hum.WalkSpeed = 16
for i,v in pairs(hum:GetPlayingAnimationTracks()) do
v:Stop()
end
hum.Animator:LoadAnimation(char:WaitForChild("Animate").walk.WalkAnim):Play()
end
isRunning = active
end
game:GetService("RunService").Heartbeat:Connect(function(dt)
if isRunning then
stamina = math.max(0, stamina - drainRate * dt)
updateUI()
print(math.floor(stamina)) -- im still testing out how much stamina is left
if stamina == 0 then
sprint(false)
isTired = false
end
else
stamina = math.min(100, stamina + refreshRate * dt)
if stamina > staminaRefresh then
updateUI()
isTired = false
print(math.floor(stamina)) -- im still testing out how much stamina is left
if isHeldingKey then
sprint(true)
end
end
end
end)
Hope y’all can help me because i’m not the sharpest tool in the shed yet…