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

Script not working?

Asked by 10 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

My MouseClicked GUI script isn't working?

Screen.MouseButton1Click:connect (function() for _,v in pairs (game:GetService ("Players").LocalPlayer.PlayerGui) do v:Destroy() end end)

Any help?

I placed a TextButton in a StarterGui, yet it still doesn't work.

1 answer

Log in to vote
0
Answered by 10 years ago
wait(0.1) -- Waiting a split second at beginning of local script is required, because local scripts tend to load earlier than GUIs and then they throw a random error
Screen = [Please do define this]

Screen.MouseButton1Click:connect (function() 
    for _,v in pairs (game:GetService ("Players").LocalPlayer.PlayerGui:GetChildren()) do 
        v:Destroy() 
    end 
end)
Ad

Answer this question