Any help would be greatly appreciated, error & setup shown in the photo
local tool = script.Parent.Parent
tool.Equipped:Connect(function()
local player = tool.Parent:WaitForChild("Animate")
player:WaitForChild("toolnone"):WaitForChild("ToolNoneAnim")
player.toolnone.ToolNoneAnim = script.Holding -- Name of the animation, inside of the script
end)
You’re trying to define 2 Instances with each other, which doesn’t work that way
There’s a couple of ways you could work with this here:
Playing the Holding Animation via the LoadAnimation function with the Animator
Your idea (You’ll have to change the AnimationId inside the Animation Object you’re attempting to change, not 2 Instances)
Completely overlap the Default Animations with your own by replacing the default Animate Script and putting it in StarterCharacterScripts (Which requires a couple steps)
Example 1:
local Tool = script.Parent
local Char, Animate
Tool.Equipped:Connect(function()
Char = Tool.Parent
Animate = Char:WaitForChild("Animate")
Animate.toolnone.ToolNoneAnim.AnimationId = script.Holding.AnimationId
end)
Example 2: (My personal thought)
local Tool = script.Parent
local Char, Hum, Animator
local CurrentAnim = nil
Tool.Equipped:Connect(function()
Char = Tool.Parent
Hum = Char:WaitForChild("Humanoid")
Animator = Hum:WaitForChild("Animator")
CurrentAnim = Animator:LoadAnimation(script.Holding) -- Make sure to set this as Action or Higher
CurrentAnim:Play()
end)
Tool.Unequipped:Connect(function()
CurrentAnim:Stop()
end)
Seems like this fixed to the first error but now I’m getting the error “LoadAnimation requires an Animation object” with your second piece of code. How do I go about fixing this?
Well if that’s the case, are you using an Animation Object? Not a Keyframe Object or something along those lines
Only other thing that I could see is that you have a duplicate object named the same thing, but I don’t see that anywhere within the Script’s Boundaries
Is there a way to do it without animation ID? It limits you from using the model outside of personal/group games because you have to reupload the animation every single time it changes hands.