Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Animation tool won't work, why?

Asked by
Nidoxs 190
8 years ago

So I have a food tool with bricks and I have a local script inside the tool. Inside the local script I have this code:

function Eat()
local humanoid = game.Players:getPlayerFromCharacter()
local animation = Instance.new("Animation")
animation.AnimationId = "http://www.roblox.com/Asset?ID=275381821" -- your id here
local animTrack = humanoid:LoadAnimation(animation) -- chanhe Humanoid to the target's Humanoid
animTrack:Play()
end

script.Parent.Equipped:connect(function(click)
local humanoid = game.Players.LocalPlayer
local animation = Instance.new("Animation")
animation.AnimationId = "http://www.roblox.com/Asset?ID=275382695" -- your id here
local animTrack = humanoid:LoadAnimation(animation) -- chanhe Humanoid to the target's Humanoid
animTrack:Play()
end)

script.Parent.Equipped:connect(function(click)
    script.Parent.Button1Down:connect(Eat)
end)



It won't work? It's supposed to hold up both hands when equipped(looped animation of two hands up) and when you click it should play the eating animation but it doesn't.

Here is the output for the second paragraph of code: 16:59:57.794 - LoadAnimation is not a valid member of Player 16:59:57.795 - Script 'Workspace.Player1.Noodle Soup.Anim', Line 13 16:59:57.796 - Stack End

Here is the output for the 3rd paragraph of code: 16:59:57.790 - Button1Down is not a valid member of Tool 16:59:57.791 - Script 'Workspace.Player1.Noodle Soup.Anim', Line 18 16:59:57.792 - Stack End

2 answers

Log in to vote
0
Answered by 8 years ago

line 10 should be local humanoid = game.Players.LocalPlayer.Character.Humanoid

Ad
Log in to vote
0
Answered by 7 years ago

Instead of using Button1Down, use Activated:

script.Parent.Activated:connect(function()

Answer this question