GetMarkerReachedSignal inside of a function

Sounds simple but im not used to this stuff, im using a tool to activate an ability that has an animation and i want to use keyframe events (added in moon animator) and it wont pick up the function

heres the tool script (local)

local Tool = script.Parent
local Player = game:GetService("Players").LocalPlayer
local Char = Player.Character
local Hum = Char:FindFirstChildOfClass("Humanoid")
local Animator = Hum:FindFirstChildOfClass("Animator")

local RS = game:GetService("ReplicatedStorage")

Tool.Activated:Connect(function()
	local Track = Animator:LoadAnimation(script.BlackFlashWindup)
	Track:Play()

	Track:GetMarkerReachedSignal("Hitbox"):Connect(function()
		print("event")
		RS.BlackFlashWindup:FireServer()
	end)
end)

cheers folks

Keyframe events are not markers. Keyframe events are deprecated by Roblox (still usable), but markers are what you should be using.

I don’t know if Moon Animator uses either markers or keyframe events, but if you are only reliant on keyframe events then you should look into Track.KeyframeReached.

Also I suggest connecting your event before calling Track:Play(). This wont fix your problem but it’s good practice.

1 Like

What if you play the anim after you connected? What if once you connected it when the marker has already fired? you’re playing it first.

Connect it first and see what happens.

decided to remake the markers in roblox provided anim editor and it now works, thank you :slight_smile:

1 Like

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