Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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.

6 comments

0

This definitely threw an error. See: "esleif". Always include your output in your questions, and always check the output first.

0

I put the text the output said, that help?

0

Dude just read your code, your error is EXTREMELY simple. Look on the line it tells you, and look at the color coding.

0

I'm new to scripting, so IDK what the colors means, and what's wrong, that's why I need help.

1

Well since this doofus just gave you the code, the issue was that you misspelled 'elseif'. READ your code

1 answer

✓ Accepted answer

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.

1 comment

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?

This discussion is preserved as it was. New answers, comments, and votes are closed.