wait()
local player = game.Players.LocalPlayer
local character = player.Character
local animation = script.Parent:FindFirstChild("Animation")
local holding = script.Parent:FindFirstChild("holding axe")
local swingAnimation = character:WaitForChild("Humanoid"):LoadAnimation(animation)
local slash = script.Parent.Handle.SlashSound
local canSwing = true
local debounce = 1
script.Parent.Activated:Connect(function()
if canSwing then
script.Parent.Enabled = false
canSwing = false
swingAnimation:Play()
slash:Play()
wait(debounce)
script.Parent.Enabled = true
canSwing = true
end
end)
Maybe the problem is your animation’s ownership? The animation should be created by the creator of the game. So if the game is developed under you then the animation should be created by you. However, if the game is developed under a group, the animation’s owner probably needs to be set under that group.
It’s just like putting print statements all over your script. So in the if statment for example, if it doesn’t print then you know what the problem is.
Dude… it’s your script can’t you just do it yourself? Smh.
Replace your script with this new one.
wait()
local player = game.Players.LocalPlayer
local character = player.Character
local animation = script.Parent:FindFirstChild("Animation")
local holding = script.Parent:FindFirstChild("holding axe")
local swingAnimation = character:WaitForChild("Humanoid"):WaitForChild("Animator"):LoadAnimation(animation)
local slash = script.Parent.Handle.SlashSound
local canSwing = true
local debounce = 1
script.Parent.Activated:Connect(function()
if canSwing then
script.Parent.Enabled = false
canSwing = false
swingAnimation:Play()
slash:Play()
wait(debounce)
script.Parent.Enabled = true
canSwing = true
end
end)
make sure that the AnimationPriority of your saved animation is set to Action or higher
animation priority is basically a way of saying what animations should overlap other animations.
if your animation is set to Core (the default, and lowest) then the idle or walking animations (which are Idle and Movement respectfully) will overlap your animation and make it appear to not play.
the full list is:
Core (lowest priority)
Idle
Movement
Action
Action2
Action3
Action4 (highest priority)
to change the animation priority, go into the animation editor and open your animation as normal,
then press the 3 dots…