Ok so I need the gui to only be activated if the players name is Plieax but when I play my game on another account the if statement still runs allowing the non-admin player admin abilities. How do I fix this?
1 | game.Players.PlayerAdded:connect ( function (plr) |
2 | if plr.Name = = "Plieax" or "" or "" then -- Put Names Of Admins Between The ""s -- |
3 | plr.PlayerGui:WaitForChild "OpenAdmin" .Enabled = true |
4 | end |
5 | end ) |
It would help if you used a table to save the admins names and used a function to check and see if they are a admin. Here is an example:
01 | local adminList = { "Plieax" , "Bob" , "Joe" } -- names are examples |
02 |
03 | function checkIfPlayerIsAdmin(player) -- will equal false if the player is not an admin |
04 | for i,v in pairs (adminList) do |
05 | if v = = player.Name then |
06 | return true |
07 | end |
08 | end |
09 | return false |
10 | end |
11 |
12 | game.Players.PlayerAdded:connect( function (player) |
13 | if checkIfPlayerIsAdmin(player) then |
14 |
15 | -- Put your code in here |
16 |
17 | end |
18 | end ) |
1 | game.Players.PlayerAdded:Connect( function (plr) |
2 | if plr.Name = = "Plieax" then |
3 | plr.PlayerGui:WaitForChild "OpenAdmin" .Enabled = true |
4 | end |
5 | end ) |