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...
01 | local tool = script.Parent |
02 | local player = game.Players.LocalPlayer |
03 | local animationtrack |
04 | local animationtwo = tool.Folder.Animation 2 |
05 | local sound = tool.Sound |
06 |
07 | local debounce = false |
08 |
09 | tool.Activated:connect( function () |
10 | if debounce = = false then |
11 | debounce = true |
12 | local c = player.Character |
13 | local h = c:WaitForChild( "Humanoid" ) |
14 | animationtrack = h:LoadAnimation(animationtwo) |
15 | animationtrack:Play() |
What i do is Check for the Humanoid and the Animation
01 | local tool = script.Parent |
02 | local player = game.Players.LocalPlayer |
03 | local animationtrack |
04 | local animationtwo = tool.Folder.Animation 2 |
05 | local sound = tool.Sound |
06 |
07 | local debounce = false |
08 |
09 | tool.Activated:connect( function () |
10 | if debounce = = false then |
11 | debounce = true |
12 | local c = player.Character |
13 | local a = tool.Folder:FindFirstChild( 'Animation2' ) |
14 | local h = c:FindFirstChild( "Humanoid" ) |
15 | if a and h then |
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.