Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why can't I see or click the gui?

I have a map script with a gui lobby. After 10 seconds, a button to close the gui should show up. The script clones the screen gui from the server storage and puts it in the starter gui. The screen gui has a frame with a button that I can't see or click. Map Script Section :

local ShowGui = game.ReplicatedStorage.CloseGui
ShowGui:FireServer()

Server Script :

local ShowGui = game:GetService("ReplicatedStorage").CloseGui
ShowGui.OnServerEvent:Connect(function(player)
game.ServerStorage.GUI.CloseRegen:Clone().Parent = game:WaitForChild("StarterGui")
or game.ServerStorage.GUI.CloseRegen:Clone().Parent == game:FindFirstChild("StarterGui")
end)

I looked in the explorer in studio and 'Close Regen' was there but not showing up. Both the main lobby and the button are parented to StarterGui, with the button having a higher Zindex. I can't see the button or click on it. I also have FE on. Why isn't it showing up?

5 comments

0

You can't click a gui, make a button or something or explain.

0

It's a button inside a frame inside a screen gui

0

use :Connect(), not :connect()

0

I did

0

@hiimgoodpack using ':Connect()' does the same thing as if you are to do ':connect()'

1 answer

✓ Accepted answer

Oh, this happened to me once. There is no scripting error, rather a misconception. First lemme explain how starter gui works

Every time a player respawns, the starter gui, is copied into each players "playerGui". Anything inside a players playergui is what actually pops up.

What is happening is that, you place the gui into the starter gui, but not the player gui.

say that you die, right after the gui is placed into the starter gui, your player gui will refresh and the gui will now appear.

SOLOUTION:

in the server script, add this code that loops through everybody and puts in that frame in their player gui

for _,plr in pairs(game.Players:GetPlayers()) do
        game.ServerStorage.GUI.CloseRegen:Clone().Parent = plr.PlayerGui
    end

BTW, in your example, you just put it into the starter gui. If showgui is a screen gui, then that works fine. BUT if it is a normal frame/button or something, THAT WILL NOT WORK. What you would have to do would be

game.ServerStorage.GUI.CloseRegen:Clone().Parent = plr.PlayerGui.ScreenGui

and put a screen gui into your startergui, but i assume you already did.

If you have any questions reply.

1 comment

0

It's working now, thanks for the help.

This discussion is preserved as it was. New answers, comments, and votes are closed.