game.Players.PlayerRemoving:Connect(function(player)
local replicated = game:GetService("ReplicatedStorage")
local pizzas = replicated:FindFirstChild("PlayerPointsStorage"):FindFirstChild(player.Name.."'s Points").Pizzas
local pizzaSlices = replicated:FindFirstChild("PlayerPointsStorage"):FindFirstChild(player.Name.."'s Points").PizzaSlices
for i, v in pairs(pizzaSlices:GetChildren()) do
print("Child: "..v.Name)
end
This function only prints the name of the first child of pizzaSlices, regardless of how many children exist. In this case that child's name is CrustPizza Interestingly, if I change the CrustPizza's name, it still returns "Child: CrustPizza." If I delete CrustPizza, it still returns "Child: CrustPizza."
The obvious explanation here would be that either pizzaSlices is in the wrong location, or it's checking a previously defined version of pizzaSlices, before the other children get added. But pizzaSlices is in the correct location, and pizzaSlices is defined 4 lines before the for loop so it cannot possibly be checking a previous version.
I cannot find a rational explanation for this.