Tweening Events Hate Callbacks

TweenSizeAndPosition
When using a callback with TweenSizeAndPosition, we see that proceeding yields do not work correctly.

local gui = game.StarterGui.ScreenGui.Frame

function revert()
	gui.Position = UDim2.new(0, 0, 0, 0)
	gui.Size = UDim2.new(0, 100, 0, 100)
end

revert()
gui:TweenSizeAndPosition(UDim2.new(0, 200, 0, 200), UDim2.new(.5, -100, .5, -100), "Out", "Quad", .3, true, function()
	print("[1] - Callback for TweenSizeAndPosition")
end)

wait(5)
print("[2] - Waited 5 seconds after TweenSizeAndPosition")

TweenSize
The callback function of TweenPosition is also not called.

local gui = game.StarterGui.ScreenGui.Frame

function revert()
	gui.Position = UDim2.new(0, 0, 0, 0)
	gui.Size = UDim2.new(0, 100, 0, 100)
end

gui:TweenSize(UDim2.new(0, 200, 0, 200), "Out", "Quad", .3, true, function()
	print("[3] - Callback for TweenSize")
end)

wait(5)
print("[4] - Waited 5 seconds after TweenSize")

TweenPosition
TweenPosition has the same problem as TweenSize.

[code]local gui = game.StarterGui.ScreenGui.Frame

function revert()
gui.Position = UDim2.new(0, 0, 0, 0)
gui.Size = UDim2.new(0, 100, 0, 100)
end

gui:TweenPosition(UDim2.new(.5, -50, .5, -50), “Out”, “Quad”, .3, true, function()
print(“[5] - Callback for TweenPosition”)
end)

wait(5)
print(“[6] - Waited 5 seconds after TweenPosition”)[/code]

Thrown All Together
If you throw those functions together, you will find that even more errors arise. While the last tween called seems to have it’s callback run, the rest do not seem to. They also throw some errors (see gif bellow).

2 Likes

GuiObject.TweenPosition has been deprecated and replaced by TweenService . Rewriting with TweenService will make it work correctly.

Thank you for your patience while this issue was outstanding; our new process is designed to help us resolve incoming bugs more efficiently.

If you experience another issue, please file a new report via the Bug Wizard so we can take another look.