i tried using get state but it didnt work and the animation keeps playing when not sprinting i looked at the dev page on humanoid get state but i didnt quite understand it any help or pointers in the right direction would help?
local UIS = game:GetService("UserInputService")
local toggle = false
local player = game.Players.LocalPlayer
local Character = player.Character
UIS.InputBegan:Connect(function(input, state)
if input.KeyCode == Enum.KeyCode.LeftControl then
if state == Enum.HumanoidStateType.None
then
return
end
if toggle == false then
toggle = true
Character.Humanoid.WalkSpeed = 25
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://04981880688"
local PlayAnim = Character.Humanoid:LoadAnimation(Anim)
PlayAnim:Play()
else
toggle = false
Character.Humanoid.WalkSpeed = 16
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://04981880688"
local PlayAnim = Character.Humanoid:LoadAnimation(Anim)
PlayAnim:Stop()
end
end
end)
