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

How can I make this script a little more dependable and efficient?

Ok, I am making a snow flake script but I want a more efficient way of doing it, this is the current script I am using but it's not the best:

player=game.Players.LocalPlayer
player.Character:WaitForChild("Torso")

flake=Instance.new("Part")
flake.BrickColor=BrickColor.new("Institutional white")
flake.Material=Enum.Material.Wood
flake.FormFactor=Enum.FormFactor.Custom
flake.Shape="Ball"
flake.CanCollide=false
flake.Transparency=0.1
flake.Size=Vector3.new(0.2,0.2,0.2)
vel=Instance.new("BodyVelocity", flake)
vel.Velocity=Vector3.new(0,-5,0)
moo=Instance.new("Model", game.Workspace)
moo.Name=game.Players.LocalPlayer.Name.."snow"

while wait() do
	flakes={}
		
	for i=1,40 do
		wait(0.15)
		if i > 0 then
			flakes[i]=flake:Clone()
			flakes[i].Parent=moo
			flakes[i].Position=player.Character.Torso.Position+Vector3.new(math.random(-15, 15),15,math.random(-15, 15))
			wait()
			if i-15>0 then
				wait()
				flakes[i-15]:Destroy()
			end
		end
	end
	for i,v in pairs(flakes) do
		wait(0.15)
		v:Destroy()
	end
end

Any recommendations to make this faster and more efficient.

1 answer

Turn the "Flake Making" process into a single function called MakeFlake(), or whatever.

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