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

Script not working?

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

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)

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