Hello, I am working on a player vs AI game, and I was trying to make a click for an attack animation, and it doesn’t give me any errors, but the animation won’t play, and I’ve put print statements they run perfectly but the animation won’t play Script:
local debounce = false
local plr = nil
script.Parent.Activated:Connect(function()
if debounce == false then
debounce = true
if plr == nil then
plr = game.Players:GetPlayerFromCharacter(script.Parent.Parent)
end
print("activated")
local anim = script.Parent.Handle.Slash
local slashanim = script.Parent.Parent:FindFirstChildOfClass("Humanoid").Animator:LoadAnimation(script.Parent.Handle.Slash)
script.Parent.Handle.Sound:Play()
slashanim:Play()
script.Parent.Trail.Enabled = true
wait(slashanim.Length)
script.Parent.Trail.Enabled = false
wait(0.5)
debounce = false
end
print("done")
end)
It also has an idle animation script which works fine.
Edit: Forgot to mention I added a print statement to print the parent of Slashanim and it says “nil”
Edit 2: R15 doesn’t work here’s a little for info