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

Need help.. I created a GUI..?

I want the GUI to be clickable, and have a message inside. I want it to be a Rules GUI, so it can be clicked and others can read the rules. Got the TextButton* to just say Rules. Can't click it, and need it to be so there is an added text onto it. Help..?

-Cammyman123

Sorry, not Textbox.. TextButton*

Heres a link..

http://gyazo.com/9a82c9766a8fe89d9d4d2947201c7b0c

I need to be able to click the "Rules" While playing the game, and then be able to.. Read the rules... Currently doesn't open at all.

1 comment

0

Provide some of your scripting to let us make it easier to help you.

1 answer

If you already have the gui set up, then you will want to create a TextButton not a TextBox. Then link the mouse button down to a function like so:

[textbutton variable].MouseButton1Down:connect(function()

then inside the function create a new textbox and put the rules there. If you want the rules to be able to disappear, then inside the function create a new text button with labeled something (ex. close) and make the original text button invisible and inactive. Then to make the open button reappear, bind the mouse click to a new function and inside the function make the original button visible and active then delete the rules text box and the close text button. Here is an example script

local screenGui = Instance.new("ScreenGui")
screenGui.Parent = script.Parent

local textButton = Instance.new("TextButton") -- Create a new textbutton for opening the rules
textButton.Parent = screenGui
textButton.Position = UDim2.new(.5,0,.5,0)
textButton.Size = UDim2.new(0, 150, 0, 50)
textButton.BackgroundColor3 = BrickColor.White().Color
textButton.Text = "Open"
textButton.MouseButton1Click:connect(function(open) -- Bind the mouseclick to a new function
	local rules = Instance.new("TextBox") -- Create the rules text box
	rules.Parent = screenGui
	rules.Position = UDim2.new(.5,0,.6,0)
	rules.Size = UDim2.new(0, 150, 0, 50)
	rules.BackgroundColor3 = BrickColor.White().Color	
	rules.Text = "No!"
	local textButton2 = Instance.new("TextButton") -- Create a new textbutton for closing the rules
	textButton2.Parent = screenGui
	textButton2.Position = UDim2.new(.5,0,.5,0)
	textButton2.Size = UDim2.new(0, 150, 0, 50)
	textButton2.BackgroundColor3 = BrickColor.White().Color
	textButton2.Text = "Close"
	textButton.Visible = false -- Make the original textbutton invisible and not active so it does not think it is being clicked
	textButton.Active = false
	textButton2.MouseButton1Click:connect(function(close)
		textButton.Visible = true -- ReActiviate and ReAppear the original textbutton
		textButton.Active = true
		rules:Destroy() -- Delete the rules textbox
		textButton2:Destroy() -- Delete the close textbutton
	end)
end)

If you have any questions then just PM me :D

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