Is this a good way to get rid of unnecessary events?

is this necessary to save memory?

	local Event -- I declare an event variable to disconnect it later


	AnimationTrack:Play()
	Caster:Start()
	Event = AnimationTrack.Ended:Connect(function() -- assign the varible to the said event
		Caster:Stop()
		Event:Disconnect() -- disconnecting it 
	end)

Yea this works but you can get around having to use a variable or manual disconnect at all by using :Once instead of :Connect.

Docs: RBXScriptSignal | Roblox Creator Documentation

2 Likes