Animation Event Crashing Game

This is my script

local animator = script.Parent.Humanoid.Animator
local animation = script.Parent.Animation

local anim = animator:LoadAnimation(animation)
anim:Play()

anim:GetMarkerReachedSignal("Hit"):Connect(function()
	script.Parent.HumanoidRootPart.bump.PlaybackSpeed = math.random(8,13)/10
	script.Parent.HumanoidRootPart.bump:Play()
end)

Every single time the animation event “Hit” gets reached it crashes roblox studio, theres not even a “Sorry roblox crashed” window it just closes.

How do i fix this?
Perhaps the function is getting fired too many times?

edit: even when i remove the function the game crashes when it reaches the event.

You can’t really do much if this is all the code. Few things you can give a shot though:

Renaming the Marker (who knows)
Removing the PlaybackSpeed line (who knows)
Testing in Live Game instead of studio to see if there’s a difference

If you can’t figure something out with those then it could be a roblox issue and you need a workaround, use the good old timing method, works the same wonders.

animationTrack:Play()

task.wait(waitTime)--figure out approximately how long you need in the animation edittor then tweak it until its perfect

--continue

This is happening because you are using animation curves. Sadly it’s a bug that you can’t do anything about other than try use traditional keyframe animations instead. Or you could wait for roblox to fix it (the staff is aware of this particular bug). This happened to me too when I used >2 markers in one animation. Perhaps your animation has more than that so lowering the amount (temporarily) could be another option.

2 Likes

Perhaps the playbackspeed is way too fast for roblox? Just an idea.