So uh basically I just want to be able to get when every animation event is in an animation, and by that I mean the time of which it will occur at, how can I do this?
local anim = nil —- your anim
local anim_track = humanoid:LoadAnimation(anim)
anim_track.KeyframeReached:Connect(function(keyframe)
print(keyframe)
end)
yes this will print the key frame when we get to it yes but thats not what I want.
I want to know when an animation event is
Animationtrack:GetTimeOfKeyframe(“name of keyframe”)
Also what do you want to get the “time” if they keyframe for? The solution I provided on my last reply should solve any animation event problem.
So I mean like animations have a thing when you are animating them called an event, you can name them and find out when that event is triggered, now an event of the animation
KeyframeReached listens for animation events…
it does? But how can I tell if the Keyframe has an event? Or does it give something in the parameter?
This would fire everytime a animation event is crossed, Idk why roblox named it keyframe reached…
Alternatively, you can do :GetMarkerReachedSignal(“keyframe name”) which does the same but only on one anim event, while keyframereached is better as you only need to call it once and use if statements or tables.
anim_track.KeyframeReached:Connect(function(keyframe)
if keyframe == "Damage" then
print('Keyframe "Damage" has been reached!')
end
end)
@FroDev1002 if this was the solution, please do mark it as one so that other people will know what to do when they have this problem.
I know, I just havent been able to know if it works yet, therefore I am unaware if it is the solution
Ok well it doesnt trigger, ever.
This is my code and as you can see yes I do use it and then print it, which never gets triggered.
Why is this?
if anim:IsA('Animation') then
local animator = rig:FindFirstChild('Humanoid'):FindFirstChild('Animator')
warn('FETCHING TIMES')
local times = {
Length = 0,
}
local loaded = animator:LoadAnimation(anim)
local z = 0
loaded:Play() -- play it
loaded.KeyframeReached:Connect(function(keyframe) -- this doesnt run
print(keyframe)
end)
repeat
task.wait()
z += 0.03
warn(z)
until loaded.Length > 0 or z >= 20
if loaded.Length > 0 then
times.Length = loaded.Length -- set length
loaded.Stopped:Wait()
loaded:Destroy()
warn(times)
else
warn('COULD NOT GET LENGTH')
end
end
show me where your putting your animation events
wdym by “Where am I putting them”. Like at what time in the animation they occur at?