So I’m making a placement system. A model gets welded together and unanchored, and then I tween its PrimaryPart down. Once it’s reached the target position, I anchor it again and remove the welds.
However, for some reason, the individual parts in the model all have what appears to be a random velocity after the model has been placed down (each part in the model has the same velocity, too).
For example:
Depending on the order of which I do somethings, the velocity will be on other axis.
What’s causing this? Is this some weird after-effect of tweening an unanchored model?
Relevant bits of welding code
local function MakeWeld(Part0, Part1)
local New = Instance.new("WeldConstraint")
New.Part0 = Part0
New.Part1 = Part1
New.Parent = Part0
return New
end
function SetWeld(Item, Welded)
local Primary = Item.PrimaryPart
Primary.Anchored = not Welded
for _, Descendant in next, Item:GetDescendants() do
if Descendant:IsA("BasePart") and Descendant ~= Primary then
Descendant.Anchored = not Welded
if Welded then
MakeWeld(Primary, Descendant)
end
elseif not Welded and Descendant:IsA("WeldConstraint") and Descendant.Parent == Primary then
Descendant:Destroy()
end
end
end
function Module:Enable(Item)
if not Item then return end
SetEnabled(Item, true)
return Item
end
function Module:Weld(Item)
if not Item then return end
SetWeld(Item, true)
return Item
end
function Module:Unweld(Item)
if not Item then return end
SetWeld(Item, false)
return Item
end
Relevant bits of placement code
local StartLocation = Location + Vector3.new(0, 10, 0)
TweenDescendantsBack(ItemObject, "BasePart", Config.Placement.TweenInfo, {Transparency = 1})
ItemObject.Parent = Items
ItemsModule:Weld(ItemObject)
ItemObject.PrimaryPart.CFrame = StartLocation
Tween(ItemObject.PrimaryPart, "CFrame", Location, Config.Placement.TweenInfo.EasingDirection, Config.Placement.TweenInfo.EasingStyle, Config.Placement.TweenTime, true, function()
ItemsModule:Unweld(ItemObject)
ItemsModule:Enable(ItemObject)
end)
Thanks