This is because StarterGui is a replication Service, meaning that whatever is a descendant of this Service will be promptly relocated to the PlayerGui Service on the Client's connection to the Server. Afterwards, any affirmations made to any descendants of StarterGui will not replicate, though will still manipulate the Instance accordingly, again.
This is primitively because this Service is meant for the Sever itself, usually to store any UI-related work for when the Player begins the Game.
The PlayerGui is the Service that will take on the job for handling the User-Interface from there forward, so to properly display the desired outcome, you must reference the Frame as a descendant of PlayerGui to see results.
Change game.StarterGui to game.Players.PlayerGui.
Additional Notes:
The MouseButton1Click method wouldn't work on a SurfaceGui Object, it must be GUIButton for this method to register according to the ROBLOX Developer Wiki.
Instead, write script.Parent for the TextBox; if this is actually restrictive to GUIButtons, then you'll have to replace the TextBox with a TextButton.
1 comment
you gotta do game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame1