Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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

7 comments

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

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.

0

VS looping through 13000 parts and changing the material of 5 parts at once which takes 26 seconds

0

That's actually what I was trying to do, but I'm not sure how to do it. Could you please help? Thanks

0

Check edit for an example

0

That actually works great, thanks! how do i mark it as answer?

0

I think there is an "Accept Answer" button beneath the comment bar

This discussion is preserved as it was. New answers, comments, and votes are closed.