I have a script that lets me click a button that spawns in a tower, but the problem is, it is spawning on its side instead of right side up, and I’m not sure how I would fix this, since nothing I have tried works.
RunService.RenderStepped:Connect(function()
if towerToSpawn then
local result = MouseRaycast({towerToSpawn})
if result and result.Instance then
local x = result.Position.X
local y = result.Position.Y + (towerToSpawn.PrimaryPart.Size.Y / 2)
local z = result.Position.Z
local cframe = CFrame.new(x,y,z)
towerToSpawn:SetPrimaryPartCFrame(cframe)
end
end
end)