Can Somebody Tell Me Why This Won't Work?

I want to have a shop so I made a Button and added the script with Tweening to open it, for some reason it does not work.

I tried fixing the script and nothing. Here is the script. :

        local Shop = script.Parent.Shop
    local OpenShop = script.Parent.OpenShop

    OpenShop.MouseButton1Up:Connect(function()
    	
    	Shop:TweenPosition(
    		UDim2.new(0.221, 0, 0.243, 0), 
    		"Out", 
    		"Quad", -- Easing Style
    		1,
    		false, 
    		)
    end)

You added a extra comma

    local Shop = script.Parent.Shop
    local OpenShop = script.Parent.OpenShop

    OpenShop.MouseButton1Up:Connect(function()
    	
    	Shop:TweenPosition(
    		UDim2.new(0.221, 0, 0.243, 0), 
    		"Out", 
    		"Quad", -- Easing Style
    		1,
    		false
    		)
    end)

Fixed it

Oh! Thank you, I will test it now.

The script is fixed but the shop still does not come out.

Can you show a video of it not working? Make sure you clicked on the UI and I perfer using .Activated because it works on mobile too.

Sure, hold on.robloxapp-20201115-1345043.wmv (2.2 MB)

Your output window should tell you what the error is. It is likely due to the fact that OpenShop is nil. You mean script.Parent.Frame.OpenShop.

  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)

Alright, thanks it works now. How would I get it to go back down?

Fixed Script:

local Shop = script.Parent.Shop
--
local OpenShop = script.Parent.Frame.OpenShop

OpenShop.MouseButton1Up:Connect(function()
    	Shop:TweenPosition(
    		UDim2.new(0.221, 0, 0.243, 0), 
    		Enum.EasingDirection.Out, 
    		Enum.EasingStyle.Quad,
    		1,
    		false
    	)
end)

That should work!
- PseudoPerson
Edit: Someone already sent this.

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)

Sorry if the script is indented very weirdly

And that would make be able to close it?

Yes it should. Also you should reply to me directly so I get a notifcation of your reply.

It works, thank you very much.