Still have questions? Join our Discord server and get real time help.
1

# 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

0
for the first script use a local script not a normal script. WideSteal321 445 — 5mo
0
If my answer solved your problem do not forget to hit that "Accept Answer" button. incapaxx 3172 — 5mo
0
shouldnt ScreenGui go into the PlayerGui? GoldAngelInDisguise 239 — 5mo

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.