To be clear, the issue is that the script gives me an admin gui. But i've tested it with alts, friends, many people not on the admin list and they still get the gui.. Here's the code (It's just one script in ServerScriptService)
1 | game.Players.PlayerAdded:connect( function (player) |
2 | if player.userId = = game.CreatorId or "320691098" or "676065804" then |
3 | game:GetService( "ServerStorage" ).ToysGui:Clone().Parent = game.Players [ player.Name ] .PlayerGui |
4 | end |
5 | end ) |
The IF statement that you created in line 2 became true because you didn't compare each userId individually. What you have to do instead is the following:
1 | if player.usedId = = userid_ 1 or player.usedId = = userid_ 2 then -- and so on... |
2 | print ( 'Display some fancy gui' ) |
3 | end |
Writing like I just did above might get the job done, but it would be pretty inefficient to have to write a comparison for each single admin. I would suggest that you create a table that contains all of the user id.
01 | local admins = { '39021093' , '1329889' , '31239' } -- example of admins |
02 | local isAdmin = false |
03 | for i = 1 ,#admins do |
04 | local admin_id = admins [ i ] |
05 | if player.userId = = admin_id then |
06 | isAdmin = true |
07 | break |
08 | end |
09 | end |
10 |
11 | if isAdmin then |
12 | print ( 'Display your gui.' ) |
13 | end |
This way you won't have to write a comparison for every admin.