ok so in workspace there are multiple Models called "Chicken" and every Chicken has a CharId that has a unique Value
what i need to do is iterate through each Chicken and print its CharId Value
i tried this but nothing was printed in console
local charId = game.Workspace.Chicken.CharId for i,v in pairs(workspace:GetChildren()) do if v.Name == "Chicken" then for i,v in pairs(workspace.Chicken:GetChildren()) do if v.Name == "CharId" then for i,v in pairs(charId:GetChildren()) do print(charId.Value) end end end end end
i also tried this but all it did was print the CharId value from only one Chicken in workspace multiple times
for i,v in pairs(workspace:GetChildren()) do if v.Name == "Chicken" then print(workspace.Chicken.CharId.Value) end end
can anyone help out?
for _,Chicken in pairs(workspace:GetChildren) do if (Chicken:IsA("Model") and Chicken.Name == "Chicken") then local CharId = Chicken:FindFirstChild("CharId") if (CharId) then print(CharId.Value) end end end