Couldn't Find Admin Player in Players

Hello devs, Im making a admin script which includes in safezone pack and my add_whitelist_tool command is not working the probelm is “print(player, char)” here. In “print(admin, tool)”, it prints Admin name and tool name player chattted but In “print(player, char)”, it prints nil and nil

Commands[Add_WhitelistTool_Command] = function(admin, tool)
	if safezone then
		print(admin, tool)
		local player = game.Players:FindFirstChild(admin)
		local char = workspace:FindFirstChild(admin)
		print(player, char)
		if player and char then
			local tool = player.BackPack:FindFirstChild(tool) or char:FindFirstChild(tool)
		if tool then
				local whitelist_folder = safezone:FindFirstChild("Whitelist Tools")
				if whitelist_folder then
					tool:Clone().Parent = whitelist_folder
					local toolsfolder_of_backpack = game:GetService("ServerStorage"):FindFirstChild(admin.."'s Tools Folder")
					if toolsfolder_of_backpack then
						tool.Parent = toolsfolder_of_backpack
					end
				end
		end
		end
		end
end

probably do a WaitForChild:(admin)

1 Like

it say Infinite yield possible on Players:WaitForChild(“Instance”)

hmmm… it could be that, your player name for the admin does not exist.
as Infinite Yield on a WaitForChild() meaning that it does not exist in the Players

1 Like

But that perfectly prints my name(admin)

did you check your Players? For it to be there

1 Like

admin is string or instance? If you use remote event/function, then most likely this is already instance (the player himself in game.Players)

1 Like

yeah im in the players property but script couldnt find me

i think it is instance but i use module

If it’s an instance, then why use FindFirstChild?

local player = admin
local char = admin.Character
1 Like

idk exactly what is instance and string but we fix that error

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.