I have 2 scripts regarding the generation system and what the generation system does is radomly copies nodes from the lighting and places them on the map each node also has a script
Node Script
while wait(0.15) do if game.Workspace.Nodes.Value < 75 then local test = game.Lighting.Spawn:Clone() test.Parent = game.Workspace game.Workspace.Nodes.Value = game.Workspace.Nodes.Value +1 test.Position = Vector3.new(math.random(1, 148),-8.5, math.random(-148, -1)) else end end
Spawning Script (error in this script)
local Spawn2 = script.Parent local tree = game.Lighting.Grass:Clone() wait(1) -- arent needed tree.Parent = game.Workspace wait(1) -- arent needed tree.Position = Vector3.new(Spawn2.Position)
I've tried doing CFrame instead of Vector3 but both have the same output which is the cloned object just spawning in 1 central place
It seems like you are searching for the following:
tree.CFrame = Spawn2.CFrame
You should use this
for i = 1,75 do --The while loop that cancels after 75 times is stupid for v = 1,100 do if math.random(-10,v) == v then break --breaks the loop it is in end end random vectors --I'm assuming that you use the wait to prevent crashing end
The reason for this is because of the formula the math.random() function uses. The formula includes the time and the content inside the script. I don't exactly know what is the formula, but this works. For a better understanding of loops, see this.