What is the use of Animaton Marker Event's parameter?

So I did some debugging to find out what animation marker event’s parameter gives you, and it gives you string.

Problem is, it gives you this string you specify every time the marker is reached. what’s the difference of defining the string in the parameter than just specifying it in the script?

Example:

animationTrack:GetMarkerReachedSignal("Event"):Connect(function (parameter)
      -- code
      text = "this is"...parameter
end

vs

local parameter = "sometring"
animationTrack:GetMarkerReachedSignal("Event"):Connect(function()
      --code
       text = " this is"..parameter
end)
1 Like

you can use that marker multiple times and pass along a table of information if you split the string, super useful stuff!

example:


--Passed Info would be something like "30,20,Character.Humanoid,0.05,true"

CamRig:GetMarkerReachedSignal("CameraShakeEvent"):Connect(function(Info)

	if Info ~= nil then
		Info = string.split(Info,",")


		--Sets default Params to avoid errors from missing Params

		local Intensity = 10

		local Length = 10

		local Target = workspace.CameraRig.Humanoid

		local TimeBetweenShake = 0.03

		if tonumber(Info[1]) ~= nil then
			Intensity = tonumber(Info[1])
		end

		if tonumber(Info[2]) ~= nil then
			Length = tonumber(Info[2])
		end

		if tonumber(Info[3]) ~= nil then
			TimeBetweenShake = tonumber(Info[3])
		end

		if Info[4] ~= nil and string.lower(Info[4]) == "true" then
			PullingAnim:Play(0)
			PullingAnim:AdjustSpeed(0)
		end

		game.ReplicatedStorage.FireCameraShake:FireClient(plr,Intensity,Length,Target,TimeBetweenShake)
	end	
end)
2 Likes