I had Removed it before but Now I just made it cancollide false and transparent.
i know this is a long dead thread, but something i don’t like about this script ( even though it’s a good feature for other things ) is that the parts spawn on top of eachother. why does this happen? is there a way to disable those parts spawning on top of the other parts? if so please tell me cause i don’t wanna have to find out how to do this myself and you are the one who made it so you should know how it works.
making it bigger doesn’t help, because of the random nature it still will have trees that just randomly decide to do that because they can.
even if you don’t reply, thank you for the script.
some more info: i’m using a model, using :MoveTo() and outside of that i haven’t modified the script at all. here is the script:
script
local tree = game.ReplicatedStorage.Tree
local spawnarea = script.Parent
local function GetRandomPosition (position, Xsize, Zsize, Yheight)
local randomX = math.random(-Xsize/2, Xsize/2)
local randomZ = math.random(-Zsize/2 , Zsize/2)
local spawnAt = Vector3.new(randomX, Yheight, randomZ)
-- spawnAt is relative to baseplate position
-- Divide Xsize into left (negative) and right (positive)
-- same with Zsize because position is at center of part
return spawnAt + position
end
local interval = 0.1
local Yheight = 2.25
local objTemplate = tree -- Your object toclone
local spawnOn = script.Parent
for i = 1,50 do
local clone = objTemplate:Clone()
local randomPos = GetRandomPosition(spawnOn.Position, spawnOn.Size.X, spawnOn.Size.Z, Yheight)
clone.Parent = workspace
clone:MoveTo(randomPos)
wait(interval)
end
edit: for those wondering ( even though i’m sure nobody has seen this ), i found the solution by simply setting a limit for the height of the spawned in objects.