So I recently started watching a tutorial how to create a game, It is going well but I recently ran into a roadblock involving my Tool Animation.
Basically, When you click the tool I created, it plays an animation, But when the Tool is cloned into backpack from the shop, the animation does not work. The rest of the functions work, but the animation doesn’t. It works fine if I were to put it in the starter pack, But I do not know why it does not work when cloned. If you know the solution, I would appreciate it. Thanks.
No, it is in a tools are in replicated storage, so i have a shop system that when you have enough currency, the tool is cloned and parented to the backpack, my problem is that the animation for cloned tool does not work when clicked. It works fine if i were to put it in the starter pack. And The script that runs the animation is a regular script
You don’t have to create a new animation track every time the tool is activated. You should also reference the animator through the player’s character since when the tool first exists/is first parented to the backpack, it’s looking for an animator inside of the player/the player’s backpack. You also have 3 debounces, you only need 1.
local players = game:GetService('Players')
local localPlayer = players.LocalPlayer
local character = localPlayer.Character or localPlayer.CharacterAdded:Wait()
local humanoid = character:WaitForChild('Humanoid')
local animator = humanoid:FindFirstChild('Animator')
track = animator:LoadAnimation(anim)
track.Priority = Enum.AnimationPriority.Action
track.Looped = false
local debounce = false
tool.Activated:Connect(function()
if debounce == false then
debounce = true
track:Play()
wait(1)
debounce = false
end
end)