Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why can't I see or click the gui?

Asked by
Viking359 161
6 years ago
Edited 6 years ago

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?

0
You can't click a gui, make a button or something or explain. BlackOrange3343 2676 — 6y
0
It's a button inside a frame inside a screen gui Viking359 161 — 6y
0
use :Connect(), not :connect() hiimgoodpack 2009 — 6y
0
I did Viking359 161 — 6y
0
@hiimgoodpack using ':Connect()' does the same thing as if you are to do ':connect()' thesit123 509 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

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.

0
It's working now, thanks for the help. Viking359 161 — 6y
Ad

Answer this question