I am attempting to create a gui that is for a specified admin list only. Everything works, except the process in which I go to admin other players. The admin has the ability to admin another player, simply by clicking their name on a custom player list that I have made myself. What the script does, is it finds the player in a PlayerList located in workspace . Unfortunatley, this error comes up when I test it in a two-person server:
Players.Player1.PlayerGui.PlayerList.Container.Player.AdminGiver:2: attempt to index a nil value
The code for my script is this:
function Clicked()
local adminValue = game.workspace.PlayerList:FindFirstChild(script.Parent.Name).isAdmin
if adminValue then
if adminValue.Value == false then
adminValue.Value = true
else
adminValue.Value = false
end
end
end
script.Parent.MouseButton1Click:connect(Clicked)
Note: In line 2, if I use WaitForChild(), no error pops up but the player is never given admin. if I use FindFirstChild(), the error immediately appears
My setup for the Player List is here: http://prntscr.com/8zwuw3
