for _,food in pairs(game.Workspace:WaitForChild("Holder"):GetChildren()) do food.Touched:connect(function(hit) local other = hit.Parent:findFirstChild("Food") local player = hit.Parent:findFirstChild("Humanoid") if other ~= nil then other:Remove() elseif player ~= nil then local plr = player.Parent food:Destroy() local getValue = game.Players[plr.Name]:WaitForChild("FoodAmount") getValue.Value = getValue.Value + 1 end end) end
Check if there is anything missing. Also, try using game.Players:getPlayerFromCharacter(plr)