Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Can someone help me turn this press-for-animation script into filtering enabled?

Asked by 6 years ago
--and get the player and character and humanoid
local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.Character:Added()
local humanoid = character:WaitForChild("Humanoid")
--Next we make our animation
local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://1352848282"
--Now we can make a function to play animations!
function playAnimation(Anim)
    local track = humanoid:LoadAnimation(Anim)
    track:Play()
end
--Now we play it when using the userinputservice
game:GetService("UserInputService").InputBegan:connect(function(input ,proc)
    if not proc then
        if input.KeyCode == Enum.KeyCode.Space then --get the F key using Enum
            playAnimation(anim) --plays our animation using our function :)
        end
    end
end)

Answer this question