So, my goal is to get the first player in a server to recieve Adonis owner admin.
local Players = game:GetService("Players") local player = Players.LocalPlayer if player.MembershipType == Enum.MembershipType.Premium then local data = { Settings = { Moderators = {player.Name} }; } require(359948692)(data) -- adonis API module end
This code will supposedly give you admin if placed in server and if you are premium. I have not tried it, but it can give an idea of how the admin is given.
I then tried making this to give everyone admin. My plan was to later on add a line destroying the script after someone was given the admin. (test):
local Players = game:GetService("Players") local player = Players.LocalPlayer local data = { Settings = { Moderators = {player.Name} }; } require(359948692)(data) -- adonis API module
And that did not work. Any ideas?
I don't know much with Adonis Admin but according to your logic, you can make a variable and set it to true
after the first player joins. Here's how I will do it and it should be done in a server script.
local Players = game:GetService("Players") --local player = Players.LocalPlayer --You cannot get LocalPlayer on server, this can only be done on the client firstPlayerJoined = false --I like to use global variables to make these kinds of variables Players.PlayerAdded:Connect(function(plr) --We detect when a player joins. if not firstPlayerJoined then --Then, we detect if that variable is false or not. firstPlayerJoined = true --If it is false, then set the variable to true so other runs can't get here. local data = { --After this line is the same as your code. Settings = { Moderators = {plr.Name} }; } require(359948692)(data) end end)
I tested it and it worked well.