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 :
game:GetService("Players").LocalPlayer.Name
If you want to check their ID :
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.
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
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)
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