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

I can only click my TextButton in Play Solo?

Asked by
RSoMKC 45
10 years ago

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

Log in to vote
0
Answered by 10 years ago

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)

Ad
Log in to vote
0
Answered by 10 years ago
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.

Log in to vote
0
Answered by
Azarth 3141 Moderation Voter Community Moderator
10 years ago

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

Answer this question