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

Cannot show GUI on click button. Issues with code or models itself?

Asked by 6 years ago

Hello. I've been having troubles with making a projector like object, and I don't know what the issue is? Here's a snippit of code for what turns it on.

1if game.Workspace.Projector.Buttons.OnButton.On.MouseClick then
2    game.Workspace.Projector.Screen.Projector.M1Frame.M1Garand.Visible = true
3end

I have click detectors on the button as well.

0
This is a ClickDetector or a TextButton? NiniBlackJackQc 1562 — 6y

1 answer

Log in to vote
1
Answered by 6 years ago

Try this.

MouseClick is a RBLXConnection so use :Connect() to use this.

01local debounce = false
02 
03game.Workspace.Projector.Buttons.OnButton.On.MouseClick:Connect(function()
04    if debounce then
05        debounce = false
06    else
07        debounce = true
08    end
09    game.Workspace.Projector.Screen.Projector.M1Frame.M1Garand.Visible = debounce
10end)
Ad

Answer this question