I have an animation that plays when the player activates a tool. Prior to them activating the tool the tool is idled in the ‘toolnone’ animation (the default idle tool animation). However, after activating the tool and playing the custom animation the ‘toolnone’ animation no longer plays. I suspected this might be because the custom animation isn’t integrated into the default ‘Animate’ script, which means that the custom animation might block default tool animations after its use. I tried integrating the animation into the ‘Animate’ script but that didn’t play the animation at all. I have also considered looping the toolnone animation until the action is required again, but this doesn’t seem like a good solution.
-- Replace the old animate script with the custom animate script
char:FindFirstChild("Animate"):Destroy()
local playerAnimate = repStor.Modules.Animate:Clone()
playerAnimate.Parent = char
--In the initial table
toolcustom = {{ id = "http://www.roblox.com/asset/?id=7418788524", weight = 10}}
--AnimateTool function
function animateTool()
if (toolAnim == "None") then
playToolAnimation("toolnone", toolTransitionTime, Humanoid, Enum.AnimationPriority.Idle)
return
end
if (toolAnim == "Slash") then
playToolAnimation("toolslash", 0, Humanoid, Enum.AnimationPriority.Action)
return
end
if (toolAnim == "Lunge") then
playToolAnimation("toollunge", 0, Humanoid, Enum.AnimationPriority.Action)
return
end
if (toolAnim == "CustomAnim") then
playToolAnimation("toolcustom", 0, Humanoid, Enum.AnimationPriority.Action)
end
end
-- In the server script that calls the animation
local str = Instance.new("StringValue")
str.Value = "CustomAnim"
str.Name = "toolanim"
str.Parent = Tool
I also put a stringvalue in the animate with an animation instance childed, although I’m not sure whether this was necessary.
Note: I’m not sure whether this method of editing the animate script is preferable, and I think that it would be better if someone could suggest an easy alternative solution.