local SlotsX
local SlotsY
local slot
for _, v in pairs(parts:GetChildren()) do
for i = 1,SlotsX*SlotsY do
slot = v
slot.Name = i
end
end
I am trying to name my parts from 1 to for ex 100.
local SlotsX
local SlotsY
local slot
for _, v in pairs(parts:GetChildren()) do
for i = 1,SlotsX*SlotsY do
slot = v
slot.Name = i
end
end
I am trying to name my parts from 1 to for ex 100.
I could use a little more context, but does this work for you?
I don’t know what SlotsX or SlotsY are. So some more explaining of the script could be useful, but here is something if you want to name parts 1-100
local SlotsX
local SlotsY
local slot
local NumberName = 0
for _, v in pairs(parts:GetChildren()) do
if NumberName < 100 then
NumberName += 1
slot = v
slot.Name = NumberName
end
end
local FolderWithParts = -- Define the Folder which Has the 100 Parts
for a, b in pairs(FolderWithParts:GetChildren()) do
b.Name=a
end
You can’t name parts after digits via script. Try this instead.
slot.Name = "" .. i
or
slot.Name = "" .. tostring(i)
Also, I dont think it’s the best idea to name parts numbers, it’s better to create a NumberValue inside of the part, and name it something like “Number”, and assign it’s value to i. Just a reccommendation of mine.
Right now its making every part 48 with y as 8 and x as 6, as it should in terms of the script , but how could it be so that every for i = 1,X*Y do also gets a new child from the folder of parts