New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

I can't seem make the animation work in this script, why won't it play?

Asked by
epicnt 13
14 days ago
Edited 3 days ago

I'm trying to make a block script, right now, I just want it to play the animation but it won't play the animation.

Tell me what I did wrong, please

The LocalScript:

local UIS = game:GetService("UserInputService")
local RS = game:GetService("ReplicatedStorage")
local RE = RS.BlockEvent
local plr = game.Players.LocalPlayer
local char = plr.Character
local humanoid = char.Humanoid

local animation = Instance.new("Animation")
animation.AnimationId = "http://www.roblox.com/Asset?ID=4823017433"
local animTrack = humanoid:LoadAnimation(animation)

local blocking = false

UIS.InputBegan:Connect(function(input, gameProcessed)
    if input.KeyCode == Enum.KeyCode.F and blocking == false then
        blocking = true
    end
end)

UIS.InputEnded:Connect(function(input, gameProcessed)
    if input.KeyCode == Enum.KeyCode.F and blocking == true then
        blocking = false
    end
end)

Thanks a lot.

Answer this question