I was wondering how to scale down a model with mesh parts too that also has constraints using a script in Roblox studio. I’ve seen other posts on how to do it but they don’t say how to also scale down and position the constraints with it.
Try this:
ResizeModel.ResizeModel = function(model, scale)
local origin = model.PrimaryPart.Position
for _, obj in ipairs(model:GetDescendants()) do
if obj:IsA("BasePart") then
obj.Size = obj.Size*scale
local distance = (obj.Position - model:GetPrimaryPartCFrame().p)
local rotation = (obj.CFrame - obj.Position)
obj.CFrame = (CFrame.new(model:GetPrimaryPartCFrame().p + distance*scale) * rotation)
elseif obj:IsA("JointInstance") then
local c0NewPos = obj.C0.p*scale
local c0RotX, c0RotY, c0RotZ = obj.C0:ToEulerAnglesXYZ()
local c1NewPos = obj.C1.p*scale
local c1RotX, c1RotY, c1RotZ = obj.C1:ToEulerAnglesXYZ()
obj.C0 = CFrame.new(c0NewPos)*CFrame.Angles(c0RotX, c0RotY, c0RotZ)
obj.C1 = CFrame.new(c1NewPos)*CFrame.Angles(c1RotX, c1RotY, c1RotZ)
end
end
end
doest a joint instance like hinges springs welds etc constraints?
I’m not sure about the springs, but where there are C0 and C1 it will work
if this helped, please set it as a solution