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.
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