I apologize for such a short question, as I'm new to scripting! However, when I try to get this simple script to work, it does not, but there are no errors viewing up. I basically want it to make the "border" (which is a ImageLabel) visible when I click on the button.
script.Parent.MouseButton1Click:connect(function() game.StarterGui.ScreenGui.border.Visible = true end)
You problem is that you're attempting to use the StarterGui
to change the objects properties. Here's a brief explanation for that:
When a player joins a game, they have a descendant service called PlayerGui
. When the PlayerGui is loaded, everything from the games StarterGui gets copied into the PlayerGui.
Everything that is in the PlayerGui is what the player actually sees on their screen, nothing from the StarterGui is visible to them.
So now, to fix your code.
Basically, all we have to do is be able to track the player, then we will be able to change the objects in the PlayerGui. This is a way we could achieve that:
First, change the Script you're using to a Localscript
if it's not one already.
Next, we can begin the code with this:
local Player = game.Players.LocalPlayer
This gets the local player from the client. (More on that here)
Lastly, we simply need to add in the rest of the code, and edit it a bit:
script.Parent.MouseButton1Click:connect(function() Player.PlayerGui.ScreenGui.border.Visible = true end)
And there you go!
Now, when we put those two things together, this is the final product:
local Player = game.Players.LocalPlayer script.Parent.MouseButton1Click:connect(function() Player.PlayerGui.ScreenGui.border.Visible = true end)
Anyways, I hope this helped. if not, or if you have any further problems/questions, please leave a comment below, and I'll see what I can do.