Does tween override pause the tween, or reset it

I’m not sure what the tween with override does, does it pause the tweens running, or reset the thing back to the original position?

Also, if a UI tween has override on, it won’t clash with camera tweens, right?

Thanks!

I assume you mean using :TweenPosition, :TweenSize and :TweenSizeAndPosition? If so, setting that to true will override any tween that’s currently tweening. It won’t pause any tween or clash with any currently running tweens.

Any tween? Even camera tweens?

Does it pause, or reset tweens, or what?

Override just basically as the name mentions. If you have a tween running on a UI using TweenPosition or one of the other tween methods and the override is set to true, if you make another tween whilst its previous tween has yet to finish, it will stop the previous tween and do the new tween from where it left off

1 Like

Yeah, creating tweens with TweenService will override any tween, regardless of instance type.

1 Like

I’m trying to do something like this:

There’s a button, you can press, that activates a tween.
Another button is next to it, that is supposed to tween the other button.

How would I make it so that the second button stops the first button, and tweens it?

I think you’d just set the Override to true when tweening if both buttons tween the same thing, I’m not sure if I understood correctly

1 Like

Alright, I’ll finish the script and post again if I have any problems. Thanks!

1 Like

I wish you good luck and if problem arises, we’ll be here to help!

1 Like

I’m having a problem, but it’s not related to the tween override.

I have these lines of code:

	if script.Parent.Position == "0.121, 0,0.33, 0" then on = false
	elseif script.Parent.Position == "0.011, 0,0.33, 00" then on = true end

It’s not working though, what would I need to add/remove to fix this?

Probably some floating point errors with it not being fully exact, what is your code right now?

Here’s my code:

script.Parent.Position = UDim2.new(0.121, 0,0.33, 0)
script.Parent.Size = UDim2.new(0.026,0,0.339,0)
local button = script.Parent.Parent.Button
local on = false

script.Parent.MouseButton1Click:Connect(function()
	--if script.Parent.Position == "0.121, 0,0.33, 0" then on = false
	--elseif script.Parent.Position == "0.011, 0,0.33, 00" then on = true end
	
	if on == false then
		script.Parent.Selectable = false
		arrow.Selectable = false
		button.Selectable = false
		script.Parent:TweenPosition(
			UDim2.new(0.011, 0,0.33, 0),
			"Out", -- easing direction
			"Sine", -- easing style
			0.35, --time in seconds
			true --override?
		)
		button:TweenPosition(
			UDim2.new(-0.08, 0,0.267, 0),
			"Out", -- easing direction
			"Sine", -- easing style
			0.35, --time in seconds
			false --override?
		)
		wait(0.4)
		on = true
		script.Parent.Selectable = true
		arrow.Selectable = true
		button.Selectable = false
	else
		script.Parent.Selectable = false
		arrow.Selectable = false
		button.Selectable = false
		script.Parent:TweenPosition(
			UDim2.new(0.121, 0,0.33, 0),
			"Out", -- easing direction
			"Sine", -- easing style
			0.35, --time in seconds
			true --override?
		)
		button:TweenPosition(
			UDim2.new(0.012, 0,0.267, 0),
			"Out", -- easing direction
			"Sine", -- easing style
			0.35, --time in seconds
			false --override?
		)
		wait(0.4)
		on = false
		script.Parent.Selectable = true
		arrow.Selectable = true
		button.Selectable = true
	end
	
end)

Just do a debounce, at the end of the if statement, jsut add

on = not on

So it inverts it

script.Parent.Position = UDim2.new(0.121, 0,0.33, 0)
script.Parent.Size = UDim2.new(0.026,0,0.339,0)
local button = script.Parent.Parent.Button
local on = false

script.Parent.MouseButton1Click:Connect(function()
	--if script.Parent.Position == "0.121, 0,0.33, 0" then on = false
	--elseif script.Parent.Position == "0.011, 0,0.33, 00" then on = true end
	
	if on == false then
		script.Parent.Selectable = false
		arrow.Selectable = false
		button.Selectable = false
		script.Parent:TweenPosition(
			UDim2.new(0.011, 0,0.33, 0),
			"Out", -- easing direction
			"Sine", -- easing style
			0.35, --time in seconds
			true --override?
		)
		button:TweenPosition(
			UDim2.new(-0.08, 0,0.267, 0),
			"Out", -- easing direction
			"Sine", -- easing style
			0.35, --time in seconds
			false --override?
		)
		wait(0.4)
		on = true
		script.Parent.Selectable = true
		arrow.Selectable = true
		button.Selectable = false
	else
		script.Parent.Selectable = false
		arrow.Selectable = false
		button.Selectable = false
		script.Parent:TweenPosition(
			UDim2.new(0.121, 0,0.33, 0),
			"Out", -- easing direction
			"Sine", -- easing style
			0.35, --time in seconds
			true --override?
		)
		button:TweenPosition(
			UDim2.new(0.012, 0,0.267, 0),
			"Out", -- easing direction
			"Sine", -- easing style
			0.35, --time in seconds
			false --override?
		)
		wait(0.4)
		on = false
		script.Parent.Selectable = true
		arrow.Selectable = true
		button.Selectable = true
	end
	on = not on
end)

Also set the override for the button to true, you made it false

Now it will do the if on == false, but then it won’t run the else.

It will only run the else when on is true

It’s not working, I tried clicking once, and doing the 1st tween, but then when I try to click again, it doesn’t work.

Wait you can remove that line I mentioned then since you’re already setting them to their opposite values anyways, but I recommend in the future you do what I did instead

1 Like

Since Position is a UDim2 value and not a string value:

if script.Parent.Position == UDim2.new(0.121, 0, 0.33, 0) then on = false
	elseif script.Parent.Position == UDim2.new(0.011, 0, 0.33, 00) then on = true end

Why would it be UDmin2.new? I don’t really get it.

Again I don’t really recommend you do that since in your 2 if statements for checking the value in on, it already converts it, you do not need to check the position of script.Parent