Change team not working for admins

Now I face another problem, I’m trying to make it so only admins can view the team change menu for admins. My script is here:

local Admins = {1636313428}

for _,id in pairs(Admins) do
	if game.Players.LocalPlayer.UserId == id then
		print("Player is admin")
	else
		script.Parent.Visible = false
	end
end	

The problem is that it doesnt get destroyed.

Use this maybe?

local Admins = {1636313428}

if table.find(Admins,game.Players.LocalPlayer.UserId) then
	print("Player is admin")
else
	script.Parent.Visible = false
end	

Also there’s nothing that destroys it in this code, it just maeks it invisible if you are not in the list

1 Like