local char = game.Players.LocalPlayer.Character
local hum = char:WaitForChild("Humanoid") --gets the humanoid
local anim1 = hum:LoadAnimation(script:WaitForChild("BlockAnim"))
local blockingval = char:WaitForChild("Blocking")
anim1:Play()
game:GetService("UserInputService").InputBegan:connect(function(input) -- Input Began checks if the player presses anything and fires whenever the player does so.
if input.KeyCode == Enum.KeyCode.F then -- This detects for a "e" press.
blockingval.Value = true
script.Cloth:Play()
anim1:Play()
hum.WalkSpeed = 6
end
end)
game:GetService("UserInputService").InputEnded:connect(function(input) -- Fires when input ended
blockingval.Value = false
anim1:Stop()
hum.WalkSpeed = 16
end)
the script works perfectly fine but whenever i stop walking the script stops