local weaponsFolder = ReplicatedStorage:WaitForChild("Weapons")
local spinnerGUI = script.Parent
local spinBorder = spinnerGUI:WaitForChild("SpinBorder")
local holder = spinBorder:WaitForChild("Holder")
-- Get all boxes (ignore UIListLayout)
local boxFrames = {}
for _, child in ipairs(holder:GetChildren()) do
if child:IsA("Frame") then
table.insert(boxFrames, child)
end
end
-- sort boxes by number name (01 → 40)
table.sort(boxFrames, function(a, b)
return tonumber(a.Name) < tonumber(b.Name)
end)
local function assignWeapons()
local weaponFrames = weaponsFolder:GetChildren()
for i, box in ipairs(boxFrames) do
-- clear old weapon frames
for _, child in ipairs(box:GetChildren()) do
child:Destroy()
end
local weaponClone
if i == 32 then
local winning = weaponsFolder:FindFirstChild("YourSpecialWeapon")
weaponClone = winning and winning:Clone() or weaponFrames[1]:Clone()
else
weaponClone = weaponFrames[math.random(1,#weaponFrames)]:Clone()
end
-- Parent to box and fill it
weaponClone.Parent = box
weaponClone.Size = UDim2.new(1,0,1,0)
weaponClone.Position = UDim2.new(0,0,0,0)
weaponClone.AnchorPoint = Vector2.new(0,0)
end
end
-- populate boxes immediately
assignWeapons()```