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.

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

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.

local debounce = false

game.Workspace.Projector.Buttons.OnButton.On.MouseClick:Connect(function()
    if debounce then
        debounce = false
    else
        debounce = true
    end
    game.Workspace.Projector.Screen.Projector.M1Frame.M1Garand.Visible = debounce
end)
Ad

Answer this question