I am trying to make a tool, that makes objects smaller, which its doing what its supposed to do so far, except for the fact everything loses its rotation and original position.
I have tried searching the internet on how to resize models with scripts, and found a thread on dev forums which shows how to do so, everything works in that script except the rotation gets messed up.
function ConstructionTool:CreateLoop(PlayerTable)
--Destroy welds
for _,object in pairs(PlayerTable.Item:GetDescendants()) do
if object:IsA('Weld') or object:IsA('ManualWeld') or object:IsA('WeldConstraint') then
object.Part0.Anchored = true
object.Part1.Anchored = true
object:Destroy()
elseif object:IsA("CFrameValue") then
object:Destroy()
end
end
-- resizing [MAIN]
return RunService.Heartbeat:Connect(function()
--Scale BaseParts
for _,object in pairs(PlayerTable.Item:GetDescendants()) do
if object:IsA('BasePart') then
object.Size = object.Size*0.999
local distance = (object.Position - PlayerTable.Item.PrimaryPart.CFrame.p)
local rotation = (object.CFrame - object.Position)
object.CFrame = (CFrame.new(PlayerTable.Item.PrimaryPart.CFrame.p + distance*0.999) * rotation)
end
end
end)
end
Oh yeah, that’s true, maybe using CFrame.Angles(object.Orientation.X, object.Orientation.Y, object.Orientation.Z) would be a good way to keep the Rotation?
I am pretty sure thats the same thing, plus I would have to use math.rad, which I think will be a big pain, but I will go give it a try. I am like 70% sure that Cframe - position is the same.
I hope you realize what you are saying, is not related to my topic at all, you are asking me to use tween service when I am asking how to resize model, not parts.