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.
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() âŚ
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)
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
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.
It should and the script should be in ServerScriptService.
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.
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.