Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to add more then 1 ID for Admins.... As if I try it doesn't work?

Asked by 3 years ago

The code :


local adminIDs = {1636474560} -- Agenerousguy - Hamoodiyt - YOBECOOLL11 game.Players.PlayerAdded:Connect(function(plr) if table.find(adminIDs, plr.UserId) then plr.CharacterAdded:Connect(function() wait() script.AdminGui:Clone().Parent = plr:WaitForChild("PlayerGui") end) end end) game.ReplicatedStorage.AdminClicked.OnServerEvent:Connect(function(admin, plrChosen, buttonChosen) if not plrChosen or not buttonChosen or not table.find(adminIDs, admin.UserId) then return end if buttonChosen == "Kill" then if plrChosen.Character and plrChosen.Character:FindFirstChild("Humanoid") then plrChosen.Character.Humanoid.Health = 0 end elseif buttonChosen == "GiveAdmin" then script.AdminGui:Clone().Parent = plrChosen:WaitForChild("PlayerGui") elseif buttonChosen == "GodMode" then if plrChosen.Character and plrChosen.Character:FindFirstChild("Humanoid") then plrChosen.Character.Humanoid.Health = plrChosen.Character.Humanoid.Health + math.huge plrChosen.Character.Humanoid.MaxHealth = math.huge end elseif buttonChosen == "UnGodMode" then if plrChosen.Character and plrChosen.Character:FindFirstChild("Humanoid") then plrChosen.Character.Humanoid.Health = plrChosen.Character.Humanoid.Health - 9999999 plrChosen.Character.Humanoid.MaxHealth = 100 end elseif buttonChosen == "RemoveAdmin" then plrChosen:WaitForChild("PlayerGui").AdminGui:Destroy() elseif buttonChosen == "Kick" then plrChosen:Kick() elseif buttonChosen == "Bring" and plrChosen.Character and admin.Character then plrChosen.Character.HumanoidRootPart.CFrame = admin.Character.HumanoidRootPart.CFrame + Vector3.new(0, 10, 0) elseif buttonChosen == "TeleportTo" and plrChosen.Character and admin.Character then admin.Character.HumanoidRootPart.CFrame = plrChosen.Character.HumanoidRootPart.CFrame + Vector3.new(0, 10, 0) end end) -- ..

The whole code works and everything but the IDs are not allowing more then one.. Any one know why ?

1 answer

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

[ANSWER EDITED]

Ok, so this is an edited answer. The way you might be able to use multiple admin ID's is this way:

local adminIDs = {1636474560, 1234567890, 123456789} --replace 123456789 and 1234567890 with the other admin ID's


game.Players.PlayerAdded:Connect(function(plr)
    for i, adminID in pairs(adminIDs) do
        if adminID == plr.UserId then
            print('Admin: ' .. plr.Name .. ' [ID: ' .. plr.UserId .. '] joined the game!')

            plr.CharacterAdded:Connect(function()
                        wait()
                        script.AdminGui:Clone().Parent = plr:WaitForChild("PlayerGui")
                end)
        end
    end
end)

I hope this works, I really don't even know how to explain the script. It just loops through the table and if it finds the player's userID, then it clones the GUI.

0
Well I found a way out to just copy the script over for every admin.. and I know that it should work when I add a comma but it doesn't I am not sure why :D Hamoodiyt 26 — 3y
0
Oh, I think table.find is not a good way. I'll edit the answer to a script that should work. NickyPlayz2011 82 — 3y
0
I edited it, can you see if that works? NickyPlayz2011 82 — 3y
0
Woah it worked :D thanks Man Hamoodiyt 26 — 3y
0
No problem! (sorry for late response) NickyPlayz2011 82 — 3y
Ad

Answer this question