I am setting up an admin panel for my game. Everything in the script seems to be okay, but the output says the PlayerGui is not a member of Player...
What did I do wrong? How can I fix my mistakes?
Here's my code:
function Entered(Player) local isAdmin = {["Bolohuc"] = true, ["Bolohucalt"] = true, ["Bolohucalt2"] = true} function findPlayer(name) for _, Player in ipairs(game.Players:GetPlayers()) do if Player.Name:lower() == name:lower() then return player end end end if isAdmin[Player.Name] then Player.PlayerGui.Server.Tabs.Admin.Visible = true print(Player.Name .. "isAdmin") else print (Player.Name .. "isnotAdmin") end end game.Players.ChildAdded:connect(Entered)
I SOLVED THIS PROBLEM MYSELF. THANKS!
local Admins = {["bolohuc"] = true, ["bolohucalt"] = true, ["bolohucalt2"] = true} -- Declare this outside of the function for global usage -- I'd enter them in lowercase to allow the script to compare a lowercase version to them function Entered(Player) -- This function will be called every time a Player joins the game if Admins[Player.Name:lower()] then print(Player.Name .. " is admin") -- It may look a little sloppy, but I'd try it. Player:WaitForChild("PlayerGui"):WaitForChild("Server"):WaitForChild("Tabs"):WaitForChild("Admin").Visible = true else print(Player.Name .. " is not an admin") end end game.Players.PlayerAdded:connect(Entered) -- I'd use PlayerAdded
Put the PlayerGui in StarterGui.
Locked by 1waffle1 and Articulating
This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.
Why was this question closed?