Hey guys, I am currently having an issue with my weld script, which moves objects from one point to another. I need the script to ignore the weld that I currently have within the set pieces to make them move with the turntable. How can I fix this? (I don’t know much about scripting so if you could modify my script for me that would be fantastic).
Weld script:
local exclude = {"Wheel"}
function WeldPair(x, y)
local weld = Instance.new("Motor6D",x)
weld.Part0 = x
weld.Part1 = y
weld.C1 = y.CFrame:toObjectSpace(x.CFrame);
end
function WeldAll(model, main)
for i,v in pairs(exclude) do if (model.Name == v) then return end end
if model:IsA("BasePart") then WeldPair(main, model) end
for _,v in pairs(model:GetChildren()) do WeldAll(v, main) end
end
function UnanchorAll(model)
if (model:IsA("BasePart")) then model.Anchored = false end
for _,v in pairs(model:GetChildren()) do UnanchorAll(v) end
end
WeldAll(script.Parent, script.Parent.Main)
for i,v in pairs(script.Parent:GetChildren()) do
if v.Name ~= "Main" and v:IsA("BasePart") then
v.Anchored = false
end
end
script:Destroy()
Issue:
Thank you for your help!