Try just removing the PlayerAdded event, I think it’s defined as nil due to there being 2 functions tightening it
script.Parent.MainMesh.ClickDetector.MouseClick:Connect(function(Player)
local PlayerBasketCapacity = game.ServerStorage.Baskets.StarterBasket.MaxCapacity
if plr.PlayerDataFolder.PlayerFoodAmount.Value >= PlayerBaskerCapacity.Value then
print("Bucket Capacity is full!")
plr.PlayerDataFolder.CanCollect.Value = false
game.ReplicatedStorage.Error:FireClient(Player)
end
end)