So basically, I have a some reference parts to help spawn a base. The problem is, I don’t know how to set the position of the base based off the parts. I am trying to make it so that the front of the base (basically the path, is connected to said part and the base is not in the ground.
What I want
What I’m getting
Code:
function BaseService.new(owner: Player)
local self = setmetatable({}, BaseService)
self.Owner = owner
self.Temp = BaseTemp:Clone()
print("Cloned")
self.Temp.Parent = Bases
print("Set Parent")
SetBasePosition(self.Temp)
return self
end
function BaseService:SetDetails()
self.Temp:SetAttribute("Owner", self.Owner.Name)
print("Set Owner")
self.Temp:SetAttribute("OwnerID", self.Owner.UserId)
print("Set Owner ID")
end
function SetBasePosition(base: Model)
local baseSpawn = BaseSpawns:GetChildren()[math.random(1, #BaseSpawns:GetChildren())]
local baseSpawnCF = baseSpawn.CFrame
local baseSize = base:GetExtentsSize()
local offset = baseSpawnCF.LookVector * (baseSize.Z / 2)
local NewCFrame = CFrame.new(baseSpawnCF.Position - offset)
base:PivotTo(NewCFrame)
end

