VineModule.lua, what is this?
![]()
This module is now in V2.
Download Here
Uncopylocked Place
Hi there,
I’m lyrnu. I’ve created a simplistic approach to creating vines. There is a vine at appears on the FORWARDS DIRECTION of a chosen part and grows randomly and procedurally, sometimes creating sub branches and little twists and turns. ![]()
Optimizations
This resource uses the --!native and --!strict transpilers for maximum performance it also uses object-pooling for maximum performance.![]()
In the Uncopylocked Place, you’ll find an intensive demonstration of how optimized this resource can be, with 5 different vines growing simultaneously with high settings!
![]()
Settings
:gear: All settings are interchangeable, and can be seen in the following list, they all affect the behaviours of the vine, and there are a lot to change!
local config = {
segmentLength = 6,
segmentRadius = 0.6,
growthInterval = 0.25,
growthEnergyCost = 6,
drainRate = 0.1,
maxEnergy = 120,
initialEnergy = 90,
waterSearchRadius = 10,
waterRegenRate = 15,
branchChance = 0.18,
branchScale = 0.45,
branchLengthScale = 0.6,
maxSegments = 120,
wallRaycastDistance = 8,
wallStickOffset = 0.15,
wobbleAngle = 18,
jitter = 0.6,
growthTweenTime = 0.12,
material = Enum.Material.SmoothPlastic,
color = Color3.fromRGB(90,140,60),
rootColor = Color3.fromRGB(60,100,45),
rootProbability = 0.12,
allowWaterBranch = false, -- toggle for water
initialDirection = nil, -- can be Vector3 for custom root direction
}
Here’s a video of it in action
:
Wait, there's more...
In case you had bad eyesight
, the VineModule
also has a changeable setting for water detection. If a part with the name “Water” is touched then the Vine will drop seeds to start a new mini plant!! By default, this setting is turned off.
I will most likely change the behaviour of this in the future, however I thought it would be a neat little thing to add. (Skip to 0:30)
(Video is a little glitchy)
Examples:
As seen in the uncopylocked place, this code provides a good example of the power of this module.![]()
local VineModule = require(game.ReplicatedStorage.VineModule)
local Workspace = game:GetService("Workspace")
-- Create multiple origin parts
local originParts = {}
local positions = {
Vector3.new(-5, 10, 0),
Vector3.new(0, 10, 0),
Vector3.new(5, 10, 0),
Vector3.new(10, 10, 0),
Vector3.new(15, 10, 0)
}
for i, position in ipairs(positions) do
local originPart = Instance.new("Part")
originPart.Name = "VineOrigin" .. i
originPart.Size = Vector3.new(2, 2, 2)
originPart.Anchored = true
originPart.Position = position
originPart.Color = Color3.fromRGB(120, 60, 30)
originPart.CanCollide = true
originPart.Parent = Workspace
-- Add visual indicator
local mesh = Instance.new("SpecialMesh")
mesh.MeshType = Enum.MeshType.Sphere
mesh.Scale = Vector3.new(1.5, 1.5, 1.5)
mesh.Parent = originPart
-- Add ClickDetector
local clickDetector = Instance.new("ClickDetector")
clickDetector.Parent = originPart
table.insert(originParts, {part = originPart, vine = nil, detector = clickDetector})
end
-- Vine configuration
local vineConfig = {
segmentLength = 6,
segmentRadius = 0.5,
growthInterval = 0.2,
branchChance = 0.45,
maxSegments = 160,
rootProbability = 0.3,
color = Color3.fromRGB(80, 160, 80),
rootColor = Color3.fromRGB(50, 120, 40)
}
-- Function to grow a vine on a specific origin
local function growVine(originData)
-- Destroy existing vine if present
if originData.vine and originData.vine.Destroy then
pcall(function()
originData.vine:Destroy()
end)
originData.vine = nil
end
-- Spawn new vine
originData.vine = VineModule:SpawnVine(originData.part, vineConfig)
end
-- Connect click events to each part
for _, originData in ipairs(originParts) do
originData.detector.MouseClick:Connect(function(player)
growVine(originData)
end)
end
-- Optional: grow vines immediately on creation
for _, originData in ipairs(originParts) do
growVine(originData)
end
Closing off
This is my first ever open-source. Let me know what I should add/improve on. I will be optimizing this even further if I get interest in this resource. Thank you guys!
![]()
Download link and Uncopylocked place here:
Download Here
Uncopylocked Place
![]()








