Click Part to Play Animation?

So, I’ve trying to create a MRI machine that once the button is clicked, that the animation that I’ve made for the machine plays (which would be the dark gray part moving in and then out). I’m wondering what script would run the animation once the part is clicked because all other tutorial involved a tool, which I do not want. Thank you!

1 Like

Put a click detector in the part of the MRI machine you want to click to play animation and in that same part add this script:

script.Parent.ClickDetector.MouseClick:Connect(function()
    —Play animation
end)
1 Like

I’ve already place that script in it, sorry I did not clarify that, but I was wondering if there was a script to play the animation with the click detector.

Well first off why don’t you just tween the part instead of animating

How would I go about doing that? I’ve seen the tween service plugin, I’m just not familiar on how to use it.

Take a look at this dev hub post:

https://developer.roblox.com/en-us/api-reference/function/TweenService/Create

All right, thank you for the help, I’ll see what I can do! Have a blessed day.

1 Like

If you want to use animation, make sure the model has humanoid and (Head, Torso/HumanoidRootPart) before doing that!
and use Motors for them not welding