How do I can play animation of objects such as parts or doors made in the moon animation with script?

Hello all of developers! I wish you a good day. Anyway I have a problem with the script. I made a animation with the moon animation and I added a Animation to the AnimSaver model. Then I put to the handle model a AnimationController and added Animator inside of it. I Exported the animation of the door by clicking Files > Export Rigs then I saved the exported animation to the roblox. I put Animation to the DoorAnim which was the animation that I put to the AnimSaver. However, I started scripting but it’s not worked. I think I’m doing something wrong and I want someone help me please. I’m not sorry if my grammar is bad. The pictures of my model and script will be in the downstairs of this text.




the script itself will be there if the quality picture of the script is low:

local Handle = script.Parent.Handle
local Proximity = Handle.BackHandle2:WaitForChild("ProximityPrompt")
local door = script.Parent

local Anim = door.AnimSave:WaitForChild("DoorAnim")
local LoadAnim = Handle.AnimationController.Animator:LoadAnimation("DoorAnim")

Proximity.Triggered:Connect(function()
	LoadAnim:Play()
end)
8 Likes

I think this might be your problem right here. I’m surprised you’re not getting an error.
You’re passing a string into the LoadAnimation function. This should be the variable “Anim” from this line:

3 Likes

Change to:

local LoadAnim = Handle.AnimationController.Animator:LoadAnimation(Anim)
1 Like

I often just publish the animation to Roblox then use the Id for the animation, then play it normally

it’s doesn’t worked. Animation is still not playing.

Are you using moon animator too?

yes. But I recommended you to animate simple thing like doors in Tween.

Pretty useful plugin. It let you edit tween like animation with easing.

I know it and I used it for my doors. But I want much more realistic and good animation. I also want to animate the door handle.

How you exporting animation of the objects from moon animation to the Roblox studio and play it with script?

export with rig, select the animation file then right click, pulish to roblox.
Copy the URL then paste it in the Animation

like how I did it File > export rigs?

Yes, then publish it then get the ID. It work for me
Then write the script like this tutorial

Thank you for this useful information and I’m exporting animation like in this video


Can you please tell me the problem if I’m doing something wrong with export.

You did the export right. so I think there is a problem with your script. Can you send the the whole script?


this is all of my script.

change to this

then if it still not working then you may have to read the document about AnimationController

1 Like

The document page is very broken rn for me and I cant access Roblox Studio to test it so I cant help you much

Of course it’s didn’t worked. There is only solution to ready AnimationController?

More googling I guess. Ive been experienced this like you and I just dig and dig untill I make it work.

First, Thank you very much for trying help me and give me some tips.
Second I’m not sorry if my grammar was bad.
Third, I also did some of my solution like you by dig and dig until I will find solution. I also had problem with the handle of the door. The handle of the door was not moving with the door itself when I did it animation. I couldn’t fixed this problem like 6 days then I find solution. Now I will find another solution to this problem too. Thank you for helping me!

1 Like