What do I want to achieve?
I want the animation in my game to play correctly.
What is the issue?
I’m experiencing problems with animating when the player equips a bat. When NPCs equip the bat, the animation plays correctly, but when the player does it, the animation doesn’t play the way I want it to.
What solutions have I already tried?
I was looking for solutions, but I still haven’t found it.
Code:
local Track
script.Parent.Equipped:Connect(function()
local Char = script.Parent.Parent;
local Motor6D = Instance.new('Motor6D')
Motor6D.Part1 = script.Parent.Handle
Motor6D.Part0 = Char:WaitForChild('Right Arm')
Motor6D.Parent = Char:WaitForChild('Right Arm')
local a:Weld = Char:FindFirstChild("Right Arm"):WaitForChild("RightGrip")
a:Destroy()
Track = Char:WaitForChild("Humanoid"):LoadAnimation(script.R6_Holding)
if Track then
Track:Play()
print("ANIM PLAY")
end
end)
script.Parent.Unequipped:Connect(function()
if Track then
Track:Stop()
end
end)
Looking through your code the only thing I can think if that makes the problem scripting related is that your using :LoadAnimation() on the Humanoid, when you should use it on Humanoid.Animator.
Try changing the line of code to
Alright, I didn’t know if it would change anything for sure. Could you send a file of the place with the tool in it so I can look into this a bit more?
Is this a local script or server script?
From what I’ve seen Animations are played on the client using local scripts.
They may play fine on NPCs because they are owned by the server.
I mean I guess you could do Movement, but then again it would be overrid when the player walks. There are 4 “Action” priorities, so having it as Action would work if you don’t want to use Action4.
Hmm, it seems I might be doing something wrong. Could you please share a video tutorial on how to do this correctly, or provide step-by-step instructions?