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

How do I make an animation play through a tool?

Asked by
AlvinC7 -5
6 years ago

Im trying to make a restaurant and I want to know something: When a character is holding some food, how do I get the character to "eat" it? I already have the animation made, I just dont know how to put it into the tool, or the "food." I just want the animation to be played when you left-click while the food is equipped.

Anyone know how to do this?

0
just say an if statement if the tool is equipped, for example: if tool.Equipped = true then anim:play() something like that greatneil80 2647 — 6y

1 answer

Log in to vote
0
Answered by
T0XN 276 Moderation Voter
6 years ago
Edited 5 years ago

This is obviously not the final product, but a concept that you could work off of to make your animation function when the player has the tool equipped and activated.

Basically, you just check if the tool is activated and then play the animation you want if it is. ROBLOX has a built-in function that if a tool is equipped and the player clicks their mouse, the tool is activated.

function toolActivated()
    animation:play()
    --eating functions etc
end

tool.Activated:Connect(toolActivated)
Ad

Answer this question