local UIS = game:GetService("UserInputService")
local lastChecked = tick()
local character = game:GetService("Players").LocalPlayer.character
local human = character:WaitForChild("Humanoid")
local Sprintanim = Instance.new("Animation")
Sprintanim.AnimationId = "rbxassetid://5969899912"
local Sprintanimtrack = human:LoadAnimation(Sprintanim)
UIS.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.W then
local now = tick()
local change = (now - lastChecked)
if change <= 0.25 then
human.WalkSpeed = 20
Sprintanimtrack:Play()
end
end
lastChecked = tick()
end)
UIS.InputEnded:Connect(function(input)
if input.KeyCode == Enum.KeyCode.W then
human.WalkSpeed = 11
Sprintanimtrack:Stop()
end
end)
when i double tap w it plays a sped up walk animation but if i press d then double tap w it auctually plays sprint
when the player auctually decides to run and changes states for example jumping it resets it to the sped up walk animation
local UIS = game:GetService(“UserInputService”)
local lastChecked = tick()
local character = game:GetService(“Players”).LocalPlayer.character
local human = character:WaitForChild(“Humanoid”)
local Sprintanim = Instance.new(“Animation”)
Sprintanim.AnimationId = “rbxassetid://5969899912”
local Sprintanimtrack = human:LoadAnimation(Sprintanim)
UIS.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.W then
local now = tick()
local change = (now - lastChecked)
if change <= 0.35 then
if speed <= 13 then
Sprintanimtrack:Play()
end
human.WalkSpeed = 20
end
end
lastChecked = tick()
end)
UIS.InputEnded:Connect(function(input)
if input.KeyCode == Enum.KeyCode.W then
human.WalkSpeed = 12
if speed >= 12 then
Sprintanimtrack:Stop()
end
end
end)
and i still get the same results
is there anyway to detect if a players speed is like 20 or over 20 then play animation idk wats wrong with my script