Cancelling all tweens on an Instance

Like the title states, Is there a way to get/cancel all tweens on an instance? Kind of like how you can get all the playing animation tracks on a humanoid.

1 Like

Not there is not, you can track every tween by adding them into a dictionary where the respective instance is the key and the value is an array of tweens. Like:

local tweens: {[Instance]: {Tween}} = {}

local function addTween(instance: Instance, tween: Tween)
	table.insert(tweens[instance] or {}, tween)
end

local function cancelTweens(instance: Instance)
	local array = tweens[instance]
	
	if array then
		for _, tween in ipairs(array) do
			tween:Cancel()
		end
		
		tweens[instance] = nil
	end
end
9 Likes