Tween speed for Gui button

local tween = script.Parent.Parent.DayNightButton


script.Parent.MouseButton1Click:Connect(function()
	if tween.Position == UDim2.new(0.087, 0,0.184, 0) then
		tween:TweenPosition(UDim2.new(0.067, 0,0.184, 0),"Out","Sine")
	else
		tween:TweenPosition(UDim2.new(0.087, 0,0.184, 0),"In","Sine")
	end
end)

how would I make the tween faster? I’ve tried different style tweens already.

its tweening close because its like a sliding button but its very slow.

In the page of the tweenposition and size in the developer hub there is a a parameter that is called time. You should put a 1 after the ‘Sine’. If you want to make even faster you can lower it to 0.5. You can look in the developer hub right here: GuiObject | Roblox Creator Documentation

local tween = script.Parent.Parent.DayNightButton


script.Parent.MouseButton1Click:Connect(function()
	if tween.Position == UDim2.new(0.087, 0,0.184, 0) then
		tween:TweenPosition(UDim2.new(0.067, 0,0.184, 0),"Out","Sine", 1)
	else
		tween:TweenPosition(UDim2.new(0.087, 0,0.184, 0),"In","Sine", 1)
	end
end)

thanks man! appreciate your help :smiley:

1 Like