I need to find the character from a player, but when I try to, it keeps resulting in infinite yield. Here’s the script:
commands.handto = function(sender,arguments)
if sender:GetRankInGroup(11635716) >= 3 then
local inventory = sender:WaitForChild("Backpack")
local character = sender:WaitForChild("Character")
if not character or not character.Parent then
character = sender.Character
end
local item
for i, tool in pairs(inventory:GetChildren()) do
if not tool.Name == "Mop" or "Notepad" then
if tool.Parent == character then
item = tool
print(item.Name)
end
end
end
for i, playerName in pairs(arguments) do
print(playerName)
end
local customerName = arguments[1]
if customerName then
local customer = findPlayer(customerName)
if customer then
item.Parent = customer:WaitForChild("Backpack")
addPoints.addPoints(sender)
end
end
end
end
How do I fix this?