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?
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.