im trying to make a close button for a gui but for someone uknown reason it always says "MouseButton1Click" is not a valid member of ImageLabel here is the script
script.Parent.MouseButton1Click:connect(function() game.StarterGui.ScreenGui.Frame.Visible = false end)
Can someone please help me ?
There are a few issues here.
1) You should be using a TextButton instead of a TextLabel. TextLabels are meant to just display text, while TextButtons are meant to be clicked to perform an action.
2) :connect() is deprecated. You should use :Connect() instead. The script should look like this:
3) You are attempting to change the frame that is in the StarterGui. The way you are doing it, it will change the Gui when a player is spawned in again. However, when a player joins a game the StarterGui is cloned into PlayerGui. This script should be a LocalScript so you can do a nifty little thing called LocalPlayer, which you can use to immediately find the player that pressed the button.
The script should look like this:
script.Parent.MouseButton1Click:Connect(function() game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.Visible = false end)
You need to change your TextLabel into a TextButton, put a LocalScript in it, then paste the script above.
If this answer helped you, please ACCEPT and UPVOTE it! Thank you!