Hello. I am making a fighting game and I am currently stuck on a problem. The problem is that my sword animation wont run even if I dont get any errors. The debugging/printing works but nothing happeneds. The code is in a localscript which is inside the handle of my sword tool. This is the code:
-- DEBOUNCE & INSTANCE
local tool = script.Parent.Parent
local swordDebounce = false
-- PLAYER
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:wait()
local Humanoid = char:WaitForChild("Humanoid")
local swordSlash = Humanoid:LoadAnimation(player.PlayerGui.Animations["Sword Slash"])
local rightarm = char["Right Arm"]
local handle6d = Instance.new("Motor6D", rightarm)
handle6d.Name = "Handle"
-- MAIN
tool.Equipped:Connect(function()
handle6d.Part0 = rightarm
handle6d.Part1 = script.Parent
end)
tool.Unequipped:Connect(function()
handle6d.Part0 = nil
handle6d.Part1 = nil
end)
tool.Activated:Connect(function()
swordDebounce = true
swordSlash.Priority = Enum.AnimationPriority.Action
print("Animation should play")
swordSlash:Play()
wait(swordSlash.Length + 1.5)
swordDebounce = false
end)
And as you can see in the following picture, it prints:
try reimporting the animation into roblox studio animation editor (default), and then before you export it again, find animation priority and make sure it’s on action.
DUDE, i just founded the solution, at least for me, i was playing my gun animation on a Local Script instead of a Script, and since my gun is not parented to my Character, it doesn’t work. what i’ll do is Make it so when i try to animate the gun, i fire that information to the server and the server plays the animation. Check it out to see if that isn’t your case aswell.