Position Part Relative to Another Part

  1. What do you want to achieve?
    Make a dirt layer out of small dirt parts at the top, but inside of another part.

  2. What is the issue?
    Can’t figure out how to position it relative to the part the dirt should be inside of.

  3. What solutions have you tried so far?
    Creating of offset by multiplying the dirt’s CFrame by the parts CFrame.

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local OreModels = ReplicatedStorage:WaitForChild("Ores")
local OresFolder = workspace:WaitForChild("Ores")
local RockSettings = require(ReplicatedStorage:WaitForChild("RockSettings"))
local OreSpawnArea = workspace:WaitForChild("OreSpawnArea")


local function SpawnDirtLayer()
	for X = 1,OreSpawnArea.Size.X,3 do
		for Z = 1,OreSpawnArea.Size.z,3 do
			local DirtOre = OreModels:WaitForChild("Dirt"):Clone()
			local NonRelativeCFrame = CFrame.new(X,1,Z)
			
			DirtOre.CFrame = What to put Here
			DirtOre.Parent = OresFolder
		end
	end
end

SpawnDirtLayer()

So you want it 1 stud above another part’s origin (centre point)?

Just do

DirtOre.CFrame = otherPart.CFrame * NonRelativeCFrame

That should work regardless of the other part’s orientation.