-
What do you want to achieve?
Make a dirt layer out of small dirt parts at the top, but inside of another part. -
What is the issue?
Can’t figure out how to position it relative to the part the dirt should be inside of. -
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()