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

How do you make moving/animated train doors?

Asked by 4 years ago

I'm currently trying to make the train doors physically move when they open. I looked into Motor6D and animations but they only seem to be able to rotate objects? (I'm not entirely sure if that's correct but it's all I could find)

I've been told other games use CFrame but I was also told that CFrame can be very clunky and laggy looking.

Screenshots Doors Closed Doors Open

Thanks!

(Since I expect someone to say it, I'm not looking for someone to script a whole movement system or anything like that, I'm just trying to find out the best way of making it.)

2 answers

Log in to vote
0
Answered by 4 years ago

I would use tween service for this, Just comment to this if you would like me to write you a script https://developer.roblox.com/en-us/api-reference/class/TweenService

Ad
Log in to vote
0
Answered by 4 years ago

Assuming that the train doesn’t have a humanoid, you will need an AnimationController in order to control the animation. A HumanoidRootPart as the model’s PrimaryPart is also needed. If you have correctly rigged your train with Motor6Ds and Welds, parts would not fall out during the animation.

I am currently working on animations for an in game crate which grants power ups during gameplay. You could try doing the same thing with your own animation. What I have done is inserted a Script, AnimationController, and an Animation object inside the model (I named mine CrateLandingTest1, this is optional).

image

Don’t forget to add your animation ID into the animation object. image

The script will tell the AnimationController to load the animation object, which returns an AnimationTrack. This can be used to play the animation.

local controller = script.Parent.AnimationController local anim = script.Parent.CrateLandingTest1 local track = controller:LoadAnimation(anim) track:Play()

Answer this question