I have been trying to make an animation play whenever i do a dash in my game but it isnt working. I know the function is firing the animation just doesnt play. if anyone wants to help please dont just send code, i want to know why it doesnt work
local UserInputService = game:GetService("UserInputService") local Player = game:GetService("Players").LocalPlayer local DashStart = game:GetService("ReplicatedStorage").Dash.Start local DashStop = game:GetService("ReplicatedStorage").Dash.Stop local Character = Player.Character or Player.CharacterAdded:Wait() local Humanoid = Character:WaitForChild("Humanoid") local Animator = Humanoid:WaitForChild("Animator") local Animation = Instance.new("Animation") Animation.AnimationId = "rbxassetid://9121007758" Animation.Parent = Character local Debounce UserInputService.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.Keyboard then if input.KeyCode == Enum.KeyCode.LeftShift and not Debounce then local Animation = Instance.new("Animation") Animation.AnimationId = "rbxassetid://9121007758" Animation.Parent = Character local Animationtrack = Animator:LoadAnimation(Animation) Animationtrack.Priority = Enum.AnimationPriority.Action Animationtrack.Looped = false Animationtrack:Play() Debounce = true DashStart:FireServer() wait(2) Debounce = false end end end) UserInputService.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.Keyboard then if input.KeyCode == Enum.KeyCode.LeftShift then DashStop:FireServer() end end end)