How do I make a Screen GUI that shows for everyone through a server script?

I want a textbutton that on my command/click (a textbutton that only shows for me) a frame in a screengui with become visible that players can click.

Again, your code is only changing the Ui in StarterGui. I also removed the thing you all were saying takes game’s memory. The function can also now be called multiple times, can be linked to for example button press on client’s Ui and can be fired from server for full control.

-- LocalScript

local RemoteEvent = game.ReplicatedStorage.EventShowUi -- The event

local UI = script.Parent -- Change it to your UI

function ChangeUiVisibility(Visible) -- 'Visible' is 'true' (visible) or 'false/nil' (invisible)

RemoteEvent:FireServer(Visible)

end

RemoteEvent.OnClientEvent:Connect(function(Visible)

UI.Visible = Visible

end)

-- ServerScript

local RemoteEvent = game.ReplicatedStorage.EventShowUi -- The event

function ChangeUiVisibility(Player,Visible)

RemoteEvent:FireAllClients(Visible)

end

RemoteEvent.OnServerEvent:Connect(ChangeUiVisibility)

if this doesn’t work, let me know.

1 Like

huh im not sure about a local textbutten for only you…

local function onActivated()
-- (ur gui stuff)
end
textButton.Activated:Connect(onActivated)

put this in the text button you don’t even need remote event

Because game.StarterGui will not do anything. StarterGui is like a StarterPack it is just for a Start. You cant edit the StarterGui or you cant edit the StarterPack when the game is already started. You will have access to the Gui Only from the Client side. So, to change anything in your gui, you need to have a LocalScript by saying
local playerGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")

That was just an idea, it can be something else if that’s easier.

i know how to make it so that the gui becomes visible but im not sure about the “personal text button”

Well, you can use my idea of cloning Ui and use this on server script:

-- ServerScript

local UserId = 0 -- Replace with your UserId
local Ui = script.ScreenGui -- Replace with your Ui (Make sure that this script is in ServerScriptService and the Ui is aswell, so exploiters can't clone it!)

function GiveSecretUi(Player)
	if Player.UserId == UserId then
		local CloneUi = Ui:Clone()
		CloneUi.Parent = Player.PlayerGui
	end
end

game.Players.PlayerAdded:Connect(GiveSecretUi)

You could also remove the :Clone() …

1 Like

This will only give the player with the right UserId the UI that will be inside the script (also make sure that ‘ResetOnSpawn’ is set to false)

1 Like

You also missed the argument of the client like @exp_lol123 did. Remote Events requires the client argument Firstly. So you need to change the arguments in your funrctions.

again, transparently will be better but clone works too

My bad, I’ll edit it right now

1 Like

Would the ScreenGUI be under the script?

Transparency would just set the GUI invisible to normal players, but visible to exploiters and I think this shouldn’t be just ignored. It is important to make your game as secure as it can get.

1 Like

It should and the script should be in ServerScriptService.

1 Like

i would rather get hacked than make the server laggy and ruin fun but you do you

Will this screengui be my secret button to fire the event?

Yes it will be the UI that only you want to get when you join the game.

1 Like

you mean the clone:ui because its a clone

I think a single :Clone() isn’t really laggy. I do like 60 :Clone()s per minute in my game and it runs just fine, even on my mobile.

1 Like