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
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.