Scripting Helpers is winding down operations and is now read-only. More info→
Ad
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
4 years ago
Edited 4 years 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