Syncing Sound in FE Gun kit Using built-in Animation Keyframes

hihi i’m the one publishing FE Gun kit viewmodel 2

I really want to actually make this tutorial for a long time and haven’t got to make any new ways to sync sound, recently people wanted to sync the gun sound in FE Gun kit and i mostly see them editing in GunClient which was an old ways by using GetMarkerReachedSignal() but that is surprisingly painful ever since you don’t know where to put as the update comes and they’re flooded by a new features.

Setting up animation

if you have pre-existing animations or your own animated guns, you have to get the rig with your guns equipped (see “How to Get player rig”)
after getting player’s character, we’ll have to open Animation Editor, This is located in “Avatar” tabs

in Animation Editor, import your animations (whatever you want) and wait for processing blender/moon created animations may take 10 sec to load as there’s too many
keyframes

after imported successfully, Get the Animation event bar open by clicking on :gear: and tap on “Show Animation Events” now that we set things up correctly, we should be able to mark any pose state.

How to Get player rig
  1. Make sure there is an animation in the setting for your tool and start playing
  2. While in game, equip your tool and hover your mouse and select your character
  3. after copied, stop the game and paste the character

Player should not be moved while selecting

Marking the animation event

Now that setup is ready, let’s start with marking

We’ll make it by sliding the timeline to where we want the marker to be at and add our own Animation event, if the marker is misplaced you can drag them to the keyframe so you don’t have to open Animation Editor everytime. (see “Inside Edit Animation Events” for example)

after created the event, now export to Roblox and close Animation editor, If you have pre-existing animation exported then override the animation you imported earlier You don’t have to worry about how events could be obtained as it’s already in the animation so this can be required

Inside "Edit Animation Events

image
You’ll first name the Event as “AnimationEvents”, This will yield the function for AnimationKeyframes to allow us getting the parameter from the same event name.

for Parameters, you can name it whatever you want but make sure there’s event name called “AnimationEvents” for example it would be “silly_pull”

You can create more than 1 events so there’s no limit

Getting the animation events

go to your gun settings. Settings for latest version are moved to ReplicatedStorage > Modules > WeaponSettings > Gun
and open the gun setting folder, The main stats setting is in a module named “1” inside “Settings”
image

Now for this part, ensure there’s your animation (with Animation Events created) for the tool
if we already have the animation ID pasted in the setting then scroll to the bottom till you’ll find “AnimationKeyframes” section in the stats setting.
image

Now here’s the part where we’ll get the animation and the events to run, but first we’ll get each individual sounds you have like “magin” “magout” etc. and put it in the “1” inside your tool (not from settings)
This is how it should be at

after everything is in place, Go back to main stats setting and add the function, if you feel like you have no clue then here’s the template of it

["AnimationName"] = {
			["KeyframeName"] = function(keyframeName, tool)
				print(keyframeName)
			end;
		};	

and the example of the events could be

AnimationKeyframes = {
			["EquippedAnim"] = {
				["1"] = function(keyframeName, tool)
					print(keyframeName)
				end;
				["2"] = function(keyframeName, tool)
					print(keyframeName)
				end;
			};
			["ReloadAnim"] = {
				["1"] = function(keyframeName, tool)
					print(keyframeName)
				end;
				["2"] = function(keyframeName, tool)
					print(keyframeName)
				end;
				["3"] = function(keyframeName, tool)
					print(keyframeName)
				end;
			};
		};
Explanation

On the first bracket here is the animation string which is from the available settings, Naming this to like “ReloadAnim” allows animation to get events signal detected from the ID

and the below one is the Parameter name which is the name we gave to the event, To not be confused “1” is not related to gun settings along with the function which we can make a custom event.

example

AnimationKeyframes = {
		["ReloadAnim"] = {
			["magout"] = function(keyframeName, tool)
				--empty.dir
			end;
		};	
	};

Now to get the signal, copy a template (see “Explanation” on how it’s structured) and yield it’s attachment from the tool, type this in the function of your parameters

local attachment = tool.Handle:WaitForChild("1") --Grabs the attachment from the tool
local magout_snd = attachment:WaitForChild("magout") -- your parameter name from event

magout_snd:Play() --make it play after event reached

Do this for each animation events, here’s how it look
image

Everything is ready and working!

now test the game and play!

10 Likes