I'm trying to make my player do an animation while I'm holding a tool, but something could be blocking it that I don't know.
local Tool=script.Parent
local V=script.Parent.HandValue.Value
local debris = game:service("Debris")
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:wait()
local UIS = game:GetService("UserInputService")
-------------------------------------------------
while Character.Parent == nil do
Character.AncestryChanged:wait()
end
local debounce = true
script.Parent.Activated:connect(function()
local function onInputBegan(input,gameProcessed)
if input.UserInputType == Enum.UserInputType.Keyboard then
if input.KeyCode == Enum.KeyCode.T then
if debounce then
debounce = false
local humanoid = Tool.Parent:FindFirstChild('Humanoid')
repeat wait() until humanoid ~= nil
local dunk = script:WaitForChild("Dunk")
local dunktrack = humanoid:LoadAnimation(dunk)
dunktrack:Play()
if Tool.Parent:FindFirstChild("Humanoid") then
Tool.Parent.Humanoid.Jump=true
end
wait(5)
debounce = true
end
end
end
end
UIS.InputBegan:Connect(onInputBegan)
end)
-LukeGabrieI

2 comments
Make sure the animation priority is set correctly. Here is a link to better understand animation prioritys: http://wiki.roblox.com/index.php?title=Animations#Priority
You could've done two tool events following up (ex. tool.Equipped:Connect(function() tool.Activated:Connect(function() [animation ]end)end))