Hello,
In this tutorial I will show you how to make a admin list with tables
This is my first tutorial so bear with me.
Lets Start!
I’m going to use a local script
I’ll be putting my script in StarterPlayerScripts. Then in ReplicatedStorage we want to add a RemoteEvent.
-- Local Script
local ReplicatedStorage = game:GetService("ReplicatedStorage") -- Getting Replicated Storage Service
local RemoteEvent = ReplicatedStorage.RemoteEvent --Getting the RemoteEvent
-- Now we fire the RemoteEvent
RemoteEvent:FireServer()
Now we add a script in ServerScriptService
-- Script
local Players = game:GetService("Players") -- Getting Players Service -- LocalPlayer
local ReplicatedStorage = game:GetService("ReplicatedStorage") -- Getting Replicated Storage Service
local RemoteEvent = ReplicatedStorage.RemoteEvent --Getting the RemoteEvent
We add a Table to the script like so
-- Script
local Players = game:GetService("Players") -- Getting Players Service -- LocalPlayer
local ReplicatedStorage = game:GetService("ReplicatedStorage") -- Getting Replicated Storage Service
local RemoteEvent = ReplicatedStorage.RemoteEvent --Getting the RemoteEvent
local Admins = { -- You can name "Admin" what ever you want
}
In are Table we add the userID of a player you want. Now we go to the Roblox Website and to the profile of the player you want to add. In you’re browser go to the ULR and theres numbers, thats the userID
And you’re script should look like this
local Players = game:GetService("Players") -- Getting Players Service -- LocalPlayer
local ReplicatedStorage = game:GetService("ReplicatedStorage") -- Getting Replicated Storage Service
local RemoteEvent = ReplicatedStorage.RemoteEvent --Getting the RemoteEvent
local Admins = { -- You can name "Admin" what ever you want
1507646970
}
If you want to add more players the Table then you should do this
local Admins = { -- You can name "Admin" what ever you want
1507646970, -- Make sure that the last userID in the Table does not end with an ","
3327692056
}
Now we add something that detects if the RemoteEvent fires
local Players = game:GetService("Players") -- Getting Players Service -- LocalPlayer
local ReplicatedStorage = game:GetService("ReplicatedStorage") -- Getting Replicated Storage Service
local RemoteEvent = ReplicatedStorage.RemoteEvent --Getting the RemoteEvent
local Admins = { -- You can name "Admin" what ever you want
1507646970, -- Make sure that the last userID in the Table does not end with an ","
3327692056
}
-- Now this function fires when RemoteEvent Fires
RemoteEvent.OnServerEvent:Connect(function(player) -- We need to add "player" to the fuction
end)
Now inside the Function we and an If statement
local Players = game:GetService("Players") -- Getting Players Service -- LocalPlayer
local ReplicatedStorage = game:GetService("ReplicatedStorage") -- Getting Replicated Storage Service
local RemoteEvent = ReplicatedStorage.RemoteEvent --Getting the RemoteEvent
local Admins = { -- You can name "Admin" what ever you want
1507646970
}
-- Now this function fires when RemoteEvent Fires
RemoteEvent.OnServerEvent:Connect(function(player) -- We need to add "player" to the fuction
if not table.find(Admins, player.UserId) then
return -- Returns if the player is not an Admin
end
end)
Inside of the function statement we add print()
RemoteEvent.OnServerEvent:Connect(function(player) -- We need to add "player" to the fuction
if not table.find(Admins, player) then
print(player.Name.." is a Admin") -- If the player is an Admin
else
print(player.Name.." is an Admin")
end)
The Full scripts
Script
local Players = game:GetService("Players") -- Getting Players Service -- LocalPlayer
local ReplicatedStorage = game:GetService("ReplicatedStorage") -- Getting Replicated Storage Service
local RemoteEvent = ReplicatedStorage.RemoteEvent --Getting the RemoteEvent
local Admins = { -- You can name "Admin" what ever you want
1507646970
}
-- Now this function fires when RemoteEvent Fires
RemoteEvent.OnServerEvent:Connect(function(player) -- We need to add "player" to the fuction
if not table.find(Admins, player.UserId) then
return
end
print(player.Name.." is an Admin")
end)
LocalScript
local ReplicatedStorage = game:GetService("ReplicatedStorage") -- Getting Replicated Storage Service
local RemoteEvent = ReplicatedStorage.RemoteEvent --Getting the RemoteEvent
-- Now we fire the RemoteEvent
RemoteEvent:FireServer()
You should get this output
Thanks for the feedback
@lxbical @ValiantWind @Gojinhan @commitblue
Any scripts in the reply I didn’t test them