Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

Generating Problem

Asked by 6 years ago

I got an answer from my question on 'Generation' about generating blocks. But is there anyway to fix this? OR understand some of it so ** I ** can fix it? It doesn't connect and stuff you can try it:

local block = script.Parent.Grass
local function GetBlock()
    return block:Clone()
end
local function GetSize()
    return block.Size.z
end
-- Assing random position ranges
local x_min, x_max = -100,100
local z_min, z_max = -100, 100
local y_min, y_max = 1,10 -- this is in block units.
for x = x_min, x_max, GetSize() do 
    for z = z_min, z_max, GetSize() do
        local height = math.random(y_min, y_max)
        for y = GetSize()/2, GetSize() * (height + 0.5), GetSize() do
            local block = GetBlock()
            block.CFrame = CFrame.new(x,y,z)
            block.Parent = game.Workspace
        end
        wait() -- due the amount of recurses; wait, otherwise roblox will crash
    end
end`

2 answers

Log in to vote
0
Answered by 6 years ago

local block = GetBlock() block.CFrame = CFrame.new(x,y,z) block.Parent = game.Workspace

That will not work because it returns a number. You cannot change a number's CFrame/Parent.

Ad
Log in to vote
0
Answered by 6 years ago

what exactly is the problem ?

Answer this question