I wanted a fully code-driven tree system I could drop into different projects, so I built this little module that handles:
-
Procedural trunk, branch, and foliage generation (no prebuilt models)
-
Config-driven variants via
Config.Defaults.Tree -
Async batching for large forests
-
Optional growth → decay → regrow cycle using TweenService
-
This is for my HiddenDevs application.
src/ReplicatedStorage/TreeGenerationGenerators/TreeGenerator.lua– main systemGenerators/AsyncScheduler.lua– simple task batcherConfig.lua– tunable settingsFactory.lua– small wrapper so other scripts can just callFactory.spawnTree(...)
src/ServerScriptService/TreeDemo.server.lua- Minimal example that spawns a forest on the baseplate.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Workspace = game:GetService("Workspace")
local Factory = require(ReplicatedStorage.TreeGeneration.Factory)
-- single tree
Factory.spawnTree(Vector3.new(0, Workspace.Baseplate.Position.Y + 1, 0), Workspace)
-- animated tree
Factory.spawnAnimatedTree(Vector3.new(10, Workspace.Baseplate.Position.Y + 1, 0), Workspace)
-- forest
Factory.spawnForest(Vector3.new(0, Workspace.Baseplate.Position.Y + 1, 0), 80, 40, Workspace)Looking forward to getting accepted, because I have been rejected two times😅