i only scripted the playing animation lines and the walking speed for now but i don't know why the animation doesn't play and all it works is the walking speed
local UIS = game:GetService("UserInputService")
local char = game.Players.LocalPlayer.Character
local hum = char:WaitForChild("Humanoid")
local walkspeed = hum.WalkSpeed
local blockwaklkspeed = walkspeed / 2
local playanim -- declare the variable here
UIS.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.F then
hum.WalkSpeed = blockwaklkspeed
local anim = script.Block
playanim = hum:LoadAnimation(anim)
playanim:Play()
end
end)
UIS.InputEnded:Connect(function(input)
if input.KeyCode == Enum.KeyCode.F then
hum.WalkSpeed = walkspeed
playanim:Stop()
end
end)```