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

why doesent gui work with mousebutton1click?

i made a textbutton under a screengui under startergui, the textbutton had this script in it

script.Parent.MouseButton1Click:Connect(function()
	print("GUI")
end)

when this didnt work i put the screengui under a script in the workspace, this is the script

game.Players.PlayerAdded:Connect(function(player)
	local gui = script.ScreenGui:Clone()
	gui.Parent = player
	end)

and the gui doesn't even go into the player

3 comments

0

for the first script use a local script not a normal script.

0

If my answer solved your problem do not forget to hit that "Accept Answer" button.

0

shouldnt ScreenGui go into the PlayerGui?

1 answer

For the first script, as already mentioned by WideSteal321, you should be using a LocalScript. When working with GUIs, you should be handling it locally since it is something only they should see. For that second script, you parent it to player.PlayerGui, as this is where all the contents of StarterGui get cloned into. You do not even need that second script, you can just place your ScreenGui in StarterGui, and it will get cloned into each player's PlayerGui, no need to reinvent the wheel.

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