Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Play animation on MouseClick?

Basically, I want it so that an animation plays when the player clicks the part. This is my code:

local s = script.Parent
local animation = s.Eating_anim
local Player = game:GetService("Players").LocalPlayer
local animTrack = Player.Character.Humanoid:LoadAnimation(animation)

s.ClickDetector.MouseClick:connect(function()
	animTrack:Play()
end)

I currently do not know what the error is, and no error was printed out. I am using a LocalScript. Anyone help please?

1 comment

0

localscripts only run in players, and player characters (not npc's) change it to normal script

1 answer

Local Scripts don't run in the workspace. If you change it to a Script and make some minor adjustments then it should work.

1 comment

0

What do you mean by minor adjustments...

This discussion is preserved as it was. New answers, comments, and votes are closed.