Tweens not working for GUI

ScreenSize = workspace.Camera.ViewportSize
SCD = false
Opened = false
TS = game:GetService("TweenService")
TS1 = TweenInfo.new(2,Enum.EasingStyle.Back,Enum.EasingDirection.InOut,0,false,0)

local openedPos = {}
Position = UDim2.new(0.028,0,0.056,0)

local closedPos = {}
Position = UDim2.new(-0.9,0,0.056,0)

Open = TS:Create(script.Parent.Parent:WaitForChild("Shop").ShopFrame,TS1,openedPos)
Close = TS:Create(script.Parent.Parent:WaitForChild("Shop").ShopFrame,TS1,closedPos)

script.Parent.Shop.MouseButton1Click:Connect(function()
	if SCD == false and Opened == false then
			Opened = true
			SCD = true
			print("Opening shop")
			Open:Play()
			wait(3)
			SCD = false
	elseif SCD == false and Opened == true then
		SCD = true
		Opened = false
		Close:Play()
		print("Closing Shop")
		wait(3)
		SCD = false
	end
end)

The GUI’s position doesn’t change at all, i’m checking it but it just doesn’t move at all. i know everything else is working because of the printing but it’s just “stuck.” any reason as to why?

changing the table properties to have table.insert gives this error
image

Before you move on it’s better to use GuiObject:TweenPosition instead of TweenService for tweening GUI elements. It makes things simpler.

Also, switch to task.wait as wait will be deprecated.

would it play automatically or do i have to use :Play() as normal? the developerhub doesn’t specify

Figured it out, thank you!

1 Like