There's two issues with the script you've provided us with.
- You've not called your 'Onclicked' function - You've not even connected it to an event.
- There's no such player called "PlayerGui", probably.
To fix these two issues and to get the result you want, you need to connect the 'OnClicked' function to the MouseButton1Click event of the 'Play' button. You also need to get the LocalPlayer. An example fix is below.
01 | local Player = game.Players.LocalPlayer |
02 | local Gui = Player.PlayerGui.ScreenGui |
03 | local Background = Gui.BackGround |
04 | local CreditsButton = BackGround.CreditsButton |
05 | local TextLabel = Background.TextLabel |
09 | Background.BackgroundTransparency = 1 |
10 | CreditsButton.Visible = false |
11 | TextLabel.Visible = false |
14 | PlayButton.MouseButton 1 Click:connect(Clicky) |
Do remember that the PlayButton variable needs to be filled out and that the PlayButton should be an ImageButton or a TextButton. It should also be noted that you don't necessarily have to get the LocalPlayer - If the script is in the GUI, or is in the PlayButton, you can quite easily just parent up. However, seeing as you didn't say where it's located, I operated under the assumption that the script is outside of the GUI.
It is also worth noting that a function can be named anything you like and doesn't need to resemble the name of the event you're planning to use.
If this doesn't work, please provide what the output spits out.