All in all, my friend has made at least 5 animations for a tool, and when you click it makes you play the animation. He set the animation to action, and the script runs my animation perfectly. But when we change the AnimationId to his animation, it doesn't work. Does anyone have any idea why this doesn't work? My script:
AnimationId: rbxassetid://5357281801
local spells = { "lumos", "nox" } local activeSpell local tool = script.Parent repeat wait() until game.Players:GetPlayerFromCharacter(tool.Parent) local plr = game.Players:GetPlayerFromCharacter(tool.Parent) local db = false local cooldown = 3 --possible future stats local mpc = plr.leaderstats.MPC.Value tool.Activated:Connect(function() if not db then db = true local anim = game.ReplicatedStorage:FindFirstChild("CastWand") local animtrack = plr.Character.Humanoid:LoadAnimation(anim) animtrack:Play() if activeSpell ~= nil then print("Working!") end wait(cooldown) db = false end end) game.PlayerAdded:Connect(function(player) game.Players.LocalPlayer.Chatted:Connect(function(msg) local spell = string.lower(msg) if spell == #spells then activeSpell = spell end end) end) -- if any future stats --[[ tool.Activated:Connect(function() if mpc == 0 then mpc = mpc + 1 end if estore == 0 then estore = estore + 20 end if cooldown == 0 then cooldown = cooldown + 1 end end) ]]
Hmm,
I haved problem before but I fixed that with Stopped all tracks in character and then playing animation or it can be issue as said Glacitron
for _,s in pairs(Character.Humanoid:GetPlayingAnimationTracks()) do s:Stop() end local load = Character.Humanoid:LoadAnimation(animation) load:Play()