Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

How Do I open and close a GUI shop? [ANSWERED]

Asked by 7 years ago
Edited 7 years ago

So I tried this to open and close my shop GUI, ~~~~~~~~~~~~~~~~~

 Box = script.Parent.Box --Frame
Button = script.Parent.OpenAndClose --TextBox
Open = false

Button.MouseButton1Down:connect(function(open)
if Open == false then
Button.Text = "Close"
Box.Visible = true
esleif Open == true then
Button.Text ="Open"
Box.Visible = false
Open = false
end
end)

~~~~~~~~~~~~~~~~~

but it didn't do anything, what's wrong with the script, or is it not in the part it should be in? Is it old, not supported in newer roblox? Here's the Output: 15:49:20.063 - Players.Player1.PlayerGui.ScreenGui.LocalScript:9: '=' expected near 'Open' Sorry, i'm new to scripting on roblox, so i'm not experienced.

0
This definitely threw an error. See: "esleif". Always include your output in your questions, and always check the output first. Pyrondon 2089 — 7y
0
I put the text the output said, that help? 121049707 0 — 7y
0
Dude just read your code, your error is EXTREMELY simple. Look on the line it tells you, and look at the color coding. Perci1 4988 — 7y
View all comments (2 more)
0
I'm new to scripting, so IDK what the colors means, and what's wrong, that's why I need help. 121049707 0 — 7y
1
Well since this doofus just gave you the code, the issue was that you misspelled 'elseif'. READ your code Perci1 4988 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

I have absolutely no idea if this question is answered or not but here's a few steps;

Make sure you have your object's in this order; ScreenGui

Inside of ScreenGui Frame --ShopFrame

Inside of Frame What you need to make your shop.

I'm not sure where you placed your button but if it's not inside of frame and instead beside frame so frame and button both have ScreenGui as parent then add a local script to the button and use this code;

local button = script.Parent
local Opened = false
local ShopFrame = button.Parent:WaitForChild("Frame") --Make sure you have the exact name in here

button.MouseButton1Down:connect(function()
    if Opened == false then
        button.Text = "Close"
        ShopFrame.Visible = true
    else
        Opened = false
        button.Text = "Open"
        ShopFrame.Visible = false
    end
end)

The error meant = sign is expected near the word "Open"

Please comment if you have any questions, otherwise, please accept answer and upvote.

0
Wait if I had a shop button on my game would I put this as a local script in the shop button to show the frame? 8jxms 9 — 4y
Ad

Answer this question