Hi, I have a model which I want to tween. I want the model to be welded a single part where I can easily move that part and the whole model moves with it? I tried making some code for it but only the single part moves and not the whole model!
local function Weld(part, base)
if part == base then return end
if part:IsA("BasePart") then
local Weld = Instance.new("Weld")
Weld.Part0 = part
Weld.Part1 = base
Weld.C0 = part.CFrame:toObjectSpace(base.CFrame)
Weld.Parent = part
end
end
local function weldCoin(coin)
local base = coin.PrimaryPart
local root = Instance.new("Part")
root.Size = Vector3.new(2, 2, 2)
root.Position = base.Position
root.Name = "RootForWelds"
root.Transparency = 0
root.Anchored = true
root.CanCollide = false
root.Parent = coin
for _, part in ipairs(coin:GetDescendants()) do
if part:IsA("BasePart") then
part.CanCollide = false
part.Anchored = false
Weld(part, root)
end
end
coin.PrimaryPart = root
end