wait(3) --wait until the UI replicates to the PlayerGui
local Shop = script.Parent.Shop
local OpenShop = script.Parent.Frame.OpenShop -- you referenced the shop wrong
OpenShop.MouseButton1Up:Connect(function()
Shop:TweenPosition(
UDim2.new(0.221, 0, 0.243, 0),
"Out",
"Quad", -- Easing Style
1,
false
)
end)
You could add a Boolean that tells you if the shop is opened or not like this
wait(3) --wait until the UI replicates to the PlayerGui
local Shop = script.Parent.Shop
local OpenShop = script.Parent.Frame.OpenShop -- you referenced the shop wrong
local shopOpened = false
OpenShop.MouseButton1Up:Connect(function()
if shopOpened == false then
--shop is not opened
Shop:TweenPosition(
UDim2.new(0.221, 0, 0.243, 0),
"Out",
"Quad", -- Easing Style
1,
false
)
shopOpened = true
else -- shop is opened
shopOpened = false
Shop:TweenPosition(
UDim2.new(0.221, 0, -1.3, 0),
"Out",
"Quad", -- Easing Style
1,
false
)
end
end)