So I made an animation and a script that fires the animation but when I test the game the animation only works for the half.
This is the script:`
local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local animation = script.Parent:FindFirstChild("Animation")
local swingAnim = character:WaitForChild("Humanoid"):LoadAnimation(animation)
local swing = true
script.Parent.Activated:Connect(function()
if swing then
swing = false
swingAnim:Play()
wait(.5)
swing = true
end
end)
And this is a vid of the animation:
And here is a vid of the animation not working:
The animation also loops the entire time so can anyone help me with this?
did you override/save the animation? plus, you’re using the deprecated method of LoadAnimation, you now have to load it inside the humanoid’s Animator
local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local animation = script.Parent:WaitForChild("Animation")
local animator = character:WaitForChild("Humanoid"):WaitForChild("Animator")
local swingAnim = animator:LoadAnimation(animation)
local swing = true
script.Parent.Activated:Connect(function()
if swing then
swing = false
swingAnim:Play()
wait(.5)
swing = true
end
end)
i meant to uncheck “looped” in the animation editor (if you didn’t already)
same for the animation editor click the three dots → set animation priority → Action