Hey all, first time posting,
I’m trying to make a system that changes the animations a character uses when holding a tool. For example, if you’re holding a sword it will play a different walking animation than when you’re holding a rifle.
Currently, I’m trying to change the animations the default animate script uses at runtime, I’ve gone into the animate script and changed it to use the AnimationId that is a child of it. I also have a script in the tool that changes the AnimationId when it’s equipped, the Id is changing successfully but the animate script doesn’t seem to use the new animation. I also set the animation to the previously used one when the tool is unequipped. I’ve tried stopping the currently playing animations after setting the new Id, but that doesn’t seem to do anything.
Here is how I’m changing the AnimationId and stoping currently playing animations:
tool.Equipped:Connect(function()
prevIdle = animscript:WaitForChild("idle"):WaitForChild("Animation1").AnimationId
animscript:WaitForChild("idle"):WaitForChild("Animation1").AnimationId = idle.AnimationId
local pat = animator:GetPlayingAnimationTracks()
for i,v in pairs(pat) do
v:Stop()
end
Any suggestions on how to properly change the default animations at runtime or maybe some completely different system I should try making are greatly appreciated.
Thanks in advance.