local function GetBlockType(Height,QuartzPercentage,MulchPercentage)
local blockType = nil
if Height >= 48 then
blockType = partClass.Grass
elseif Height <= 25 then
blockType = partClass.Rock
if QuartzPercentage == 1 then
blockType = partClass.Quartz
end
else
blockType = partClass.Dirt
if MulchPercentage == 1 then
blockType = partClass.Mulch
end
end
return blockType
end
local origin = dirt.Position
local direction = (dirt.Position + Vector3.new(0,2556,0)) - dirt.Position
local raycast = workspace:Raycast(origin,direction,params)
if raycast then
local distance = (origin - raycast.Position).Magnitude
local inst = raycast.Instance
if inst:IsA('BasePart') then
if inst.Name == 'Dirt' or inst.Name == 'Mulch' then
return
end
end
elseif not raycast then
local grass = partClass.Grass.Part:Clone()
grass.Position = dirt.Position + Vector3.new(0,grid,0)
grass.Orientation = dirt.Orientation
grass.Parent = workspace.Map[grass.Name]