GUI Script Issue

I’m currently having a little problem with my script and my screen GUI, the script seems to work but at the same time doesn’t.

What I mean by this is, the script does cause the frame to be visible if you look into the StarterGUI section, however when you open the map GUI (KeyBind), it’s not visible.

Here’s the script:
image

As you can see below, it does turn the frame visible, however it isn’t actually visible on the game:

(That box should be yellow)

Shouldn’t the ‘Active’ checkbox be checked?

1 Like

Yeah, I meant to do that, but even with that it still doesn’t work.

1 Like

Hello!

When working with GUIs, the player does not see the StarterGui service. What they see is basically a replicated version: the PlayerGui.

This means that whatever you do to the StarterGui will basically not be visible to anyone, as it’s not on their screens. It basically serves as a template for what the players’ PlayerGui will spawn as when they join the game.

The PlayerGui is located inside of each player’s Player instance in game.Players. Changes made to the PlayerGui are what the player will see. Each player has a unique PlayerGui so that players will not all have the same screens at the same time.

These changes must also always be client side as the client is the only one who can access their own PlayerGui.

:slightly_smiling_face: I hope this was any help! Feel free to ask if you’d like some more clarification.

3 Likes

Hello, although your point has helped me understand GUI’s more as I’m new to GUI’s and am not experienced, I fixed the issue after re-writing the script. Thank you for help and information though!

2 Likes

No problem! Learning is never a bad thing.

1 Like

StarterGui immediately get’s cloned to PlayerGui and it’s not what the player sees. It’s just serves a secondary template for PlayerGui for what the player will see as Luxury said. Make the changes on the client, not on the server as PlayerGui exists for every client.

I fixed your script.

local KeyBindFrame = script.Parent.Parent:WaitForChild("KeyBind"):FindFirstChild("Frame") -- Fix the path

script.Parent.MouseButton1Click:Connect(function()
     KeyBindFrame.Visible = false
     wait(1)
     KeyBindFrame.Frame.Visible = true
     script.Parent.Parent.Visible = false
     workspace.block.Transparency = 1
     workspace.block.CanCollide = false
     KeyBindFrame.ImageLabel.Frame.Visible = true 
     wait(10
 
     workspace.block.Transparency = 0
     workspace.block.CanCollide = true

end)

All you need to do is that since you haven’t told where you will place the script, you will need to correct the path of the KeyBindFrame variable or your script will throw an error, not a valid member.

2 Likes