I’m trying to make a crate from MM2, but it takes a couple of seconds to load. Is there a faster method of doing this?
function Buy()
if player_main.leaderstats.Coins.Value >= 1000 then
local check = replicatedStorage:WaitForChild("CheckMoney"):InvokeServer(1000)
if check == true then
mainFrame.ShopFrame.Visible = false
for i, v in pairs(mainFrame.Randomizer.ActualFrame:GetChildren()) do
if v:IsA("TextLabel") then
if v.Name == "TextLabel" then
local realTable = {}
local actualIndex = 1
for p, b in ipairs(replicatedStorage:WaitForChild("Boxes"):GetDescendants()) do
if (b:IsA("Model") and b.Name ~= "Delivery Box") then
table.insert(realTable, actualIndex, b)
actualIndex += 1
end
end
local numb = replicatedStorage:WaitForChild("GetRdnm"):InvokeServer(realTable)
local rdnm = realTable[numb]
v.Text = rdnm.Name
repeat wait() -- Removes everything but the selected item itself.
for i, v in pairs(realTable) do
table.remove(realTable, i)
end
until next(realTable)
actualIndex = 0
end
end
end
mainFrame.Randomizer.Visible = true
script.RandomSpin:Play()
tweenService:Create(mainFrame.Randomizer.ActualFrame, tweenInfoS, {Position = UDim2.new(-5.492, 0,0.076, 0)}):Play()
end
end
end
So I make a for loop for each fake or unchosen item, then I show the frame.