I want to pass more than just a string to KeyframeMarker values

As a Roblox developer, it is currently too hard to create a system dependent on animations where I require multiple values to be passed as markers only allow one string argument to be passed.

If Roblox is able to address this issue, it would improve my development experience because it would better allow me and my team to take advantage of markers and unlock their potential as markers are a great tool for triggering actions to occur alongside animations.

Current use case

My current use case is allowing my sound designer to comfortably configure properties for sounds by a marker’s value fields alone. Currently they need to edit game code to play the sounds at specific moments as well as configure the properties of the sound through a line of code I give them that they drop in where desired (and for me, this is not desired in most cases).

What I would like to be able to do is not require them to edit any game code at all. I could make a generic effects handler that will read information off the keyframe marker, configure the sound and then play it, while all the sound designer would need to do to both add and test sounds without worrying about breaking game code (which has happened before) is configure fields in a keyframe marker.

Sound designer: Adds keyframe marker → Adds fields they want that I support (sound id, volume, delay before playing, time position, time to last, so on) to marker → Done
Programmer (me): Create generic module → Use GetMarkerReachedSignal → Collect key-value pairs in event → Load in sound, configure properties accordingly then play to specifications

Why current methods do not work

The only reasonable way I can get this done is by instructing the sound designer to write sound data in JSON format but that’s not entirely intuitive. Animations do not support getting all markers in an animation nor their timestamps so I can’t make a best guess as to which markers are related. Adding multiple markers and just providing different values would be chaos to figure out which ones are related (e.g. one provides volume, one provides SoundId - but how do I figure out if they’re belonging to the same instruction or not? What if I want more than one sound at the time?).

Workarounds & possible solutions for Roblox

I could write a plugin that simulates my desired use case by making a list of fields the sound designer needs to fill in and then having a button spit out a JSON format that the sound designer copies and pastes to the marker’s value. This is the only reasonable non-first party solution and I have no aversion to using it if this feature request seems out of scope.

I feel it would be better for Roblox to support this natively so I can more intuitively design my system. Instead of having to write my own tooling or workarounds to support this feature, it could become first party and work for many teams on Roblox. Sound designers using animation-dependent timing could just make specifications for how a sound should be ran and then programmers just need to read off that data. The ideal is being able to receive multiple name-value pairs, be it through an API or collating the fields given to markers in a dictionary.


Good news for me is that since posting this feature request, I’ve found a way I could intuitively construct my system without native support for this feature, potentially even the way markers were intended to be used rather than my crackpot method. It’s pretty trivial and easy to do as well, it’s just that I didn’t think of it back then and tunnel visioned into doing it a very specific way.

The simple workaround here is that I use the marker value as an instance lookup. For my use case which is synchronising sounds to an animation, I can use the marker’s value to perform a lookup for a placeholder instance and read its attributes to further determine my sound’s properties. Value provides the instance’s name, attributes provide the deeper configuration.

I guess the only scary thing would be if AnimationTrack.Animation ever returns nil or something that doesn’t contain my instances which then I’d be forced to figure out a new format, but as far as I’m concerned I’ve resolved my use case’s problem. I can also see from an engineering perspective how this might be a particularly difficult feature to tackle without either exposing more instances in the animation loading process or complicating the API.

I’ve decided that I no longer have a valid use case for this feature and will be shelving it. If I ever have a better use case, I will write a feature request for that. The answer really was just to make use of the API to create an intuitive solution rather than rack my brains over something that might be infeasible.


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.