Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

¿How do I replicate Blox fruit's fast mode script?

Asked by 2 years ago
Edited 2 years ago

Bloxfruits has this thing called "Fast mode", when you enable it, all the part's material gets changed to smoothplastic. Not instantly, but they go through the parts so quickly. Does anyone know how I can achieve this?

I've tried doing this:

local Parts = {}
local RenderStepped = game:GetService("RunService").RenderStepped

for i,v in ipairs(Workspace:GetDescendants()) do
    if v:IsA("BasePart") then
        table.insert(Parts, v)
    end
end

warn(#Parts)
local Tick = tick()

for i,v in ipairs(Parts) do
    task.spawn(function ()
        v.Material = Enum.Material.SmoothPlastic
    end)
    RenderStepped:Wait()
end

warn("Took: ", tick() - Tick)

This script takes whole 5 minutes on 13000+ parts, meanwhile in Blox Fruits they loop through the same amount of parts in less than 30 seconds.

Any help would be appreciated, thanks.

1 answer

Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

I would remove task.spawn completely because its creating 13000+ threads(a lot)

for i,v in ipairs(Parts) do
    v.Material = Enum.Material.SmoothPlastic
    RenderStepped:Wait()
end

I'm not sure if RenderStepped:Wait() is required in this scenario so I would test with and without it.

EDIT: for the looping idea try this:

local count = 1
for i,v in ipairs(Parts) do
    v.Material = Enum.Material.SmoothPlastic
    count += 1
    if count == 5
        RenderStepped:Wait()
        count = 1
    end
end
0
The wait is necessary, that's the whole point of the script. With or without the task.spawn, it takes 5x times more. Still thanks GxsChxmbxr 2 — 2y
0
My other guess is for you to change the materials of a few parts at once. If you looped through 13000 parts and it waited 0.01 seconds in between each it would take 130 seconds. virushunter9 943 — 2y
0
VS looping through 13000 parts and changing the material of 5 parts at once which takes 26 seconds virushunter9 943 — 2y
0
That's actually what I was trying to do, but I'm not sure how to do it. Could you please help? Thanks GxsChxmbxr 2 — 2y
View all comments (3 more)
0
Check edit for an example virushunter9 943 — 2y
0
That actually works great, thanks! how do i mark it as answer? GxsChxmbxr 2 — 2y
0
I think there is an "Accept Answer" button beneath the comment bar virushunter9 943 — 2y
Ad

Answer this question