Can GetMarkerReachedSignal degrade performance if not disconnected

Hi, I have a combat system that relies on a specific marker in the animation to trigger the hitbox and once triggered its disconnected, so players have time to react, but in that time if another player hits the person in the punch animation before the marker is reached it stops the animation, but what happens to that marker event that was never reached?

local hitmarker: RBXScriptConnection
hitmarker = AnimationTrack:GetMarkerReachedSignal("hitmarker"):Connect(function()
	hitmarker:Disconnect()
end)

Nothing; the signal will remain unused in memory until it is disconnected.

Ok, and my game is based on combat so if they arent hit and too much of these accumulate it will just hog performance

It won’t impact script runtime but it will waste memory.

1 Like

All connections use a bit of memory, everything uses memory, you should try and disconnect and clear anything that won’t be used anymore, or it’s going to be hogging up a bit of memory. Even variables inside scripts use memory, so while I doubt you ever run into such a situation where you need to worry about scripts using a bit more memory than is required, you should generally clear stuff when it has a chance to become a problem later on.

1 Like