Animation Player Setup
Now, we will be setting up our ride's animation player.
You may be thinking, Animation Players? Why can't I have my ride simulate in real time?
The TL;DR of it is that having the system be a custom-animation system solves the main Roblox problem of having to sync our coaster between server and clients. Since we are using a custom way to move the coaster that's not using Roblox's physics engine, we will not get the benefit of Roblox's built-in syncing.
Inside of our coaster's RideData, you'll find a Folder named AnimationPlayers
which, similar to tracks, contains all of the animation players used by our ride.
We will looking at the Train1
data inside of AnimationPlayers
.
![](/rtrf/assets/images/train_1_anim_player-a0732ab070f0d0e7b8b7cdb20a7f23cc.png)
The coaster template's Train1
track has already been setup to be used by most coasters.
The contents are:
- Model: StringValue
- Tags: Folder
In older versions such as framework v1, you used to be able to config more properties of the start state of the animation player such as the start animation and start time.
In v2, this is simplified to just the Model and any tags, since most of the state will be scripted anyway.
Model
The Model
value sets the Model used by the animation player when the game starts.
Tags
The Tags
Folder contains all of the tags for the AnimationPlayer
If you are familiar with CollectionService
, this is somewhat similar in it's use case.
The template already has a tag named Train
.
Model Setup
If you notice, the Model value of our animation player's data was not a Model, but a StringValue.
The framework supports a few ways to set an animation player's Model. It can either be a:
- StringValue (default)
- Model
- ObjectValue whose value is a Model.
Using the StringValue method, the value itself corresponds to the name of a child in the RideData's Models
Folder. The animation player then clones it and uses the copy as it's Model.
Compared to the others, benefit is that it makes it much easier to replace a Model, especially when multiple animation players use the same one.
We will replace the default TrainModel
Model in the Models
folder with the TrainModel
Model in the workspace.
![](/rtrf/assets/images/replace_train_model-6c876f9bfa980be8313c4954e0fdae37.png)