-
What do you want to achieve?
I want to make it so whenever the event markers “HitStart” and “HitStop” are reached in an AnimationTrack, the script will print that they have been reached. -
What is the issue?
I have a local script that detects when the animation events are reached, and another one that changes the TimePosition of the animation so it won’t slow down when the player’s framerate drops. (Yes that’s a real thing and it’s annoying)
For some reason, changing the TimePosition of the animation affects that, making the events go undetected.
Marker detection script
for i,Animation in pairs(Animations.All) do
Animation:GetMarkerReachedSignal("HitStart"):Connect(function(Distance)
print("START!!!")
end)
Animation:GetMarkerReachedSignal("HitStop"):Connect(function(Distance)
print("STOP!!!")
end)
end
TimePosition changing script
RunService.PreRender:Connect(function(DeltaTime) -- I doubt it has something to do with the PreRender event, but I'll mention it just in case!
for Animation,Time in pairs(Anims) do
Time += DeltaTime*Animation.Speed
Anims[Animation] = Time
Animation.TimePosition = Time
end
end)
With TimePosition changing: https://gyazo.com/10ed7d97eb35d7bf654ae7dfbef618f9
Without: https://gyazo.com/3e636feba7182829ec645f68618998e1
-
What solutions have you tried so far?
Well, I tried removing the TimePosition changing code, and it works perfectly without that… and unfortunately that’s how I found out about the problem.
And yes, I did search around the internet, but found no answer.
I thought about trying to use the KeyframeSequenceProvider service, but for now I prefer to stick to the easier way, just in case there will be a solution to the problem.
Is there really a solution to this that doesn’t require me to remove the TimePosition changing script?
Is it a bug within Roblox’s engine?
Maybe the real bugs are the friends we made along the way?
Thanks for reading