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

I can only click my TextButton in Play Solo?

Anyone know what might cause this problem? I've got this small '?' button that explains a sentence. When you click on it in Edit or Public, nothing happens. If you click on it in Play Solo, it detects the click properly.

Here is the script if that helps

script.Parent.MouseButton1Click:connect(function()
  if script.Parent.TextBox.Visible == false then
	script.Parent.TextBox.Visible = true
  else
	script.Parent.TextBox.Visible = false
end
end)

http://puu.sh/a73eo/f7dbd7361b.png A screenshot of the situation in Edit

3 answers

There doesn't seem to be any thing wrong but you could make the script faster by using this one which works in the same way. ive tested it on my profile and it works

script.Parent.MouseButton1Click:connect(function()
txtBox=script.Parent.TextBox
  if txtBox.Visible  then
    txtBox.Visible = false
  else
    txtBox.Visible = true
end
end)

local TB = script.Parent.TextBox -- define TB as the textbox
script.Parent.MouseButton1Click:connect(function() -- connect the click function
	TB.Visible = not TB.Visible -- Switch the textbox's visibility
end) -- close the connect line

This should be in a **localscript** rather than a normal script. That was your problem. The single line should make it a little easier to understand the code, too.


local box = script.Parent:WaitForChild("TextBox")
script.Parent.MouseButton1Click:connect(function()
 	box.Visible = not box.Visible
end)

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