So I have this animation script. It is in a local script, and the local script is under a tool. The script works fine in studio, but then once i upload my game to roblox, the animation doesn't seem to play. Help!
local tool = script.Parent local player = game.Players.LocalPlayer local animationtrack local animationtwo = tool.Folder.Animation2 local sound = tool.Sound
local debounce = false
tool.Activated:connect(function() if debounce == false then debounce = true local c = player.Character local h = c:WaitForChild("Humanoid") animationtrack = h:LoadAnimation(animationtwo) animationtrack:Play() sound:Play() wait(.7) animationtrack:Stop() wait(.2) debounce = false end end)
tool.Unequipped:connect(function() animationtrack:Stop() end)
I'm sorry here's the code...
local tool = script.Parent local player = game.Players.LocalPlayer local animationtrack local animationtwo = tool.Folder.Animation2 local sound = tool.Sound local debounce = false tool.Activated:connect(function() if debounce == false then debounce = true local c = player.Character local h = c:WaitForChild("Humanoid") animationtrack = h:LoadAnimation(animationtwo) animationtrack:Play() sound:Play() wait(.7) animationtrack:Stop() wait(.2) debounce = false end end) tool.Unequipped:connect(function() animationtrack:Stop() end)
What i do is Check for the Humanoid and the Animation
local tool = script.Parent local player = game.Players.LocalPlayer local animationtrack local animationtwo = tool.Folder.Animation2 local sound = tool.Sound local debounce = false tool.Activated:connect(function() if debounce == false then debounce = true local c = player.Character local a = tool.Folder:FindFirstChild('Animation2') local h = c:FindFirstChild("Humanoid") if a and h then local animationtrack = h:LoadAnimation(animationtwo) if animationtrack then animationtrack:Play() sound:Play() wait(.7) animationtrack:Stop() wait(.2) debounce = false end end end end) tool.Unequipped:connect(function() animationtrack:Stop() end)
Have you tried buying the anamation? From my experience, If the animations not made by Roblox then the game owner needs to own it for it to work. Go to the library and click on a random model, then replace the ID with the anamation ID.
Tell me if this worked.