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

Any way to show a certain GUI to certain people?

What I have so far is obviously the GUI, and a slight ide of what to code. Put a local script in the ScreenGUI which sees if the players userID = (neededID) through an if statement.

It would go like


local plr = game.Players.LocalPlayer

userID = 123456

frame = script.Parent.Frame (frame is what I want shown)

Gui  = script.Parent

if plr.UserId = UserID then 

	Gui.Frame.Visible = true

end

I just need to know what to change in the code and if some variables should be changed to local. I hope this doesn't get flagged as a request because I made most of the code myself ( I'm not the best scripter).

2 answers

✓ Accepted answer
local plr = game.Players.LocalPlayer
local userID = 123456
local Gui  = script.Parent
if plr.UserId == userID then 
    Gui.Enabled = true
end

this may work. it is best for the entire GUI to be disabled unless its that player and the variables and stuff are case sensitive

again bad code practice coming from legend because you may want to whitelist other people in the future

parent the gui you want to replicate to the script and parent the script to a place exploiters cant reach like server script service

the correct code you should be using

local plrs = game:GetService("Players")
local userids = {123456}
local Gui  = script:WaitForChild("guiname")

plrs.PlayerAdded:Connect(function(player) for i,v in pairs(userids) do if plr.UserId == v then Gui:Clone().Parent = player.PlayerGui end end)

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