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.
You would need to check their name or ID.
If you want to check their name :
1 | game:GetService( "Players" ).LocalPlayer.Name |
If you want to check their ID :
1 | game:GetService( "Players" ).LocalPlayer.UserId |
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.
1 | local player = game.Players.LocalPlayer |
2 | if player.Name = = "doomblade_66" or player.Name = = "otherProgrammerDude" then |
3 | local gui = player.PlayerGui:WaitForChild( "GuiName" ) |
4 | gui.Enabled = true |
5 | 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
1 | local player = game.Players.LocalPlayer |
then it checks if the player name = my name or whoever that is.
1 | if player.Name = = "doomblade_66" or player.Name = = "otherProgrammerDude" then |
after that it make gui equal to the players Player Gui.
1 | local gui = player.PlayerGui:WaitForChild( "GuiName" ) |
Then It set gui to enabled
1 | gui.Enabled = true |
2 | end |
I hope this enlightened you, cheers
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:
01 | local AdminGui = game.ServerStorage [ "" ] -- gui name between quotes |
02 | local uid = "" -- Your userId here |
03 |
04 | game.Players.PlayerAdded:Connect( function (player) |
05 | if player.UserId = uid then |
06 | player.CharacterAdded:Connect( function () |
07 | AdminGui:Clone().Parent = player.PlayerGui |
08 | end |
09 | end |
10 | end ) |
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
1 | local gui = game.StarterGui.kickplayer -- the kickplayer is the ScreenGui, I named it like that |
2 | local player = game.Players.LocalPlayer |
3 |
4 | if player.Name = = "YourUsername" or "ThatSomeone" then |
5 | gui.Enabled = true |
6 | else |
7 | gui:Destroy() |
8 | 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