Obviously, if that’s what your trying to do?
Yes.But if a player get the gui if hes not a admin?
Should i kick or remove the gui from him?
Kick will kicking him from the server meaning i will reset the guis (not the datastore)
Remove the ui? It will prolly remove the entertainment of users if yur gonna kick the person because of a bug
i mean, if i remove the gui should remove the admin gui?
But could you exactly tell me how could they bypass the ui?
Yes??? You remove the ui if the user is a non-admin or no permission.
i Think the best choice is using UserIds, they cant be changed
You can use Player:Kick(“reason”) to kick the player.
But if the player does something to get something really rare and a admin joins and the script accidently kicks the player, it will make them really angry.
I didnt understand what you meant, can you give more details?
If the player is playing the game normally and a admin joins, and the player has the name like the admin and he get the gui and the script kicks him, will it saves the datagui? no, so it should remove the gui from the player and give the to admin.
Using player:Kick(“reason”) is the worst choice.
No. Thats not how it works. (I may misunderstood what you said.)
If an admin joins the game, it will enable the UI.
If non admin joins the game, it wont enable the UI.
If non-admin uses an exploit to use a command. The system code will automatically detect it and kick the player.
Oh. i understand now, i will try make a code, but if i fail i will make another post
local admins = {
require(script.Parent.Settings).Ranks
}
function IsAdmin(player)
for _,Admin in pairs(admins) do
if Admin:lower() == player:lower() then
return true
end
end
return false
end
game.Players.PlayerAdded:Connect(function(Player)
if IsAdmin(Player) then
local ui = script.AdminGUI:Clone()
ui.Parent = Player.PlayerGui
elseif script.AdminGUI:Clone().Parent == Player.PlayerGui and not IsAdmin(Player) then
Player:Kick("Reason: \n Exploiting to AdminScreen. \n Kicked By System")
end
end)
my English language is bad so is hard to understand
the elseif part is totally wrong. You can loop trough children of PlayerGui and if any child is AdminGui then you can kick them.
Yeah But i dont know how to do it
Me:
You can change the elseif part to the following:
if IsAdmin(Player) then
-- your code
elseif Player.PlayerGui:FindFirstChild(uiname) and not IsAdmin(Player) then
Player:Kick()
end
Simply, what all the script does that it searches for the UI in the player’s gui folder and if it is found but they aren’t admin the game will kick them
EDIT: The issue that was with your old code is that the system will create an UI and set it is parent to the player GUI even if they didn’t want to and thats why the players get kicked for no reason.
if you want to talk about the script, the only admin script is done and i need do a ban script so i will continue at here.