I'm trying to make a leaves falling from the tree.. I really appreciate if you help me,Thank you.
COMMUNITY QUESTION
How do you make a part which fall slowly,spinning and also loopable?(Falling in a same spot)
1 answer
Ok first of all you need to declare some variables:
local tree = game.Workspace.YourTree -- Change the tree's path to your current one
local minSec = 0.6 -- The minimum seconds between the last falling and the next one
local maxSec = 3 -- The maximum seconds between the last falling and the next one
Ok, what does this means?
treethis is the instance of your tree model, read the commend for more info :D
minSec ok so this is a little hard for me to explain, I'm italian that's why, think this:
leaf1
leaf2
leaf3
the leaf1 will fall down from the tree
now, a "math.random()" will get a random number between the minSec and the maxSec
let's think that the random number is "3" ok?
when the leaf1 falls, it waits 3 seconds before the leaf2 will fall.
I hope you understand =)
maxSecsame as over
Ok now that we have the variables we need to make a function that will causes the leaves fall:
function startLeavesFalling()
-- Add here your vector3 starting position, I suggest you to start the falling at the top of the tree ;)
local startingPosition = {}
-- The leaf will be cloned, we suppose that we want infinte leaves ok?
local leaf = tree.StockParts.Leaf:Clone()
-- We declared a random second between minSec and maxSec for better reality
local randomSec = math.random(minSec, maxSec)
leaf.Parent = tree -- There will be spawned the leaf =)
leaf.Name = "Leaf"
-- The leaf will be spawned in a random position from our array of starting positions
leaf.Position = startingPosition[math.random(1, #startingPosition)]
wait(randomSec) -- We wait the random second before we start another leaf falling event
leaf:Destroy() -- We destroy the leaf after another one has spawned, causing no lag =)
end
After that we need to call the function, call it wherever you want by using this code:
startLeavesFalling()
I hope you understand :D
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
He's actually not requesting a script, he just wants to know what to do to make that. You can just tell him use this and this, instead of giving him a script. :p
Then ok, I'm editing the post
I edited the post