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 5 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 — 5y
0
this is not a request site, you would need to check their id or name. Creacoz 210 — 5y
0
alright i forgot this isnt a request site sorry, i figured it out anyway EllaTheFloofyFox 106 — 5y

4 answers

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

You would need to check their name or ID.

If you want to check their name :

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

If you want to check their ID :

1game:GetService("Players").LocalPlayer.UserId
Ad
Log in to vote
0
Answered by 5 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.

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

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

1local player = game.Players.LocalPlayer

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

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

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

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

Then It set gui to enabled

1gui.Enabled = true
2end

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 — 5y
0
you are correct, but I am more familiar with LocalPlayer doomblade_66 55 — 5y
Log in to vote
0
Answered by 5 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:

01local AdminGui = game.ServerStorage[""] -- gui name between quotes
02local uid = "" -- Your userId here
03 
04game.Players.PlayerAdded:Connect(function(player)
05if player.UserId = uid then
06    player.CharacterAdded:Connect(function()
07            AdminGui:Clone().Parent = player.PlayerGui
08        end
09    end
10end)
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 — 5y
Log in to vote
0
Answered by 4 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

1local gui = game.StarterGui.kickplayer -- the kickplayer is the ScreenGui, I named it like that
2local player = game.Players.LocalPlayer
3 
4if player.Name == "YourUsername" or "ThatSomeone" then
5    gui.Enabled = true
6else
7    gui:Destroy()
8end

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