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

Any way to make an owner only gui? i have no clue :|

Asked by 4 years ago

So i need help making a gui that is only for 2 people, is there a way to do this? also if possible it doesnt dissapear on death, i know i didnt put much effort into this so you dont have to help if you want, i also have no idea how to do so. thanks for reading help if you want.

0
What kind of GUI, like an overhead one or a screengui? Reset8449879 204 — 4y
0
this is not a request site, you would need to check their id or name. Creacoz 210 — 4y
0
alright i forgot this isnt a request site sorry, i figured it out anyway EllaTheFloofyFox 106 — 4y

4 answers

Log in to vote
0
Answered by
Creacoz 210 Moderation Voter
4 years ago
Edited 4 years ago

You would need to check their name or ID.

If you want to check their name :

 game:GetService("Players").LocalPlayer.Name

If you want to check their ID :

 game:GetService("Players").LocalPlayer.UserId
Ad
Log in to vote
0
Answered by 4 years ago

So what you have to do is get the screen gui, plop it in StarterGui,and put a localscript in it. It HAS to be a local script otherwise we can't use localPlayer, which is what this script relies on. Then put this code In there.I have tested in.

local player = game.Players.LocalPlayer
if player.Name == "doomblade_66" or player.Name == "otherProgrammerDude" then
    local gui = player.PlayerGui:WaitForChild("GuiName")
    gui.Enabled = true
end

In if Player.Name put your guys names. Also, I would like to teach you how the script works, so you can modify it how you like. First It creates a variable named player and makes its value equal to game.Players.LocalPlayer

local player = game.Players.LocalPlayer

then it checks if the player name = my name or whoever that is.

if player.Name == "doomblade_66" or player.Name == "otherProgrammerDude" then

after that it make gui equal to the players Player Gui.

local gui = player.PlayerGui:WaitForChild("GuiName")

Then It set gui to enabled

gui.Enabled = true
end

I hope this enlightened you, cheers

0
You could use a server script, and make it like, Game.Players.PlayerAdded:Connect(Function() if etc. then clone it to there PlayerGui? or would this not work killerbrasko2002 33 — 4y
0
you are correct, but I am more familiar with LocalPlayer doomblade_66 55 — 4y
Log in to vote
0
Answered by 4 years ago

Never use a localscript to make an owner only gui. Also never use name when adding players to a list. Use UserId. Names can be changed on ROBLOX.

Put the owner only gui in ServerStorage then put this code in a server script in ServerScriptService:

local AdminGui = game.ServerStorage[""] -- gui name between quotes
local uid = "" -- Your userId here

game.Players.PlayerAdded:Connect(function(player)
if player.UserId = uid then
    player.CharacterAdded:Connect(function()
            AdminGui:Clone().Parent = player.PlayerGui
        end
    end
end)
0
This is actually great for me to learn, thanks! I 100% forgot about roblox Id's. and this is a really clean script. doomblade_66 55 — 4y
Log in to vote
0
Answered by 3 years ago

I hope this can help, and also it is possible that it won't disappear when you die.

put the script in ServerScriptService and don't make the script a local script.

you said you want it for two people right? if you have the specific username of that someone, maybe your friend? idk or his/her user id, then you can make the script like this

local gui = game.StarterGui.kickplayer -- the kickplayer is the ScreenGui, I named it like that
local player = game.Players.LocalPlayer

if player.Name == "YourUsername" or "ThatSomeone" then
    gui.Enabled = true
else
    gui:Destroy()
end

and also to make the gui doesn't disappear when you die, click your ScreenGui at the StarterGui. I named my ScreenGui, it is kickplayer as shown in the script. after you click it, look at the properties and tick ResetOnSpawn. it means everytime you die, the gui will load again, which means it won't disappear. If you're making a loading gui, make sure to untick the ResetOnSpawn just a quick tips.

I hope this helps. If it does, please tick my answer :D

Answer this question