Sure. Basically its using a conditional statement while its setting a variable. So it’s saying, make Direction equal to what ever it is. But I gave it a condition. Direction == 1 and 0. So if direction is already equal to 1. It will set it to 0. And the or statement is just saying if its 0 then its 1. So basically it makes direction = opposite of what it is.
1 Like
If you have a model, you need to SetPrimaryPart. Then you tween the primary part. The primary part can be this exact purple part you have above and you just make it transparent and no collisions. I use a block that has the name “P” and I just move P around and the rest of the model follows.
Parts automatically weld when they are placed against each other. If they are like overlapping with no real edges lining up, then you probably need to manually weld them.
You can get a list of all the children and chick if it isa part and then if it is, create a weld and set part 0 and part 1.
local weldMe = pathToModel;
-- welds two parts
function weld(root, part)
local w = Instance.new("WeldConstraint");
w.Part0 = root;
w.Part1 = part;
w.Parent = root;
end
-- recursively welds everything in a model
-- THE MAIN MODEL MUST HAVE A PRIMARY PART
function recursiveWeld(root, model)
for _, c in ipairs(model:GetChildren()) do
if ( c:IsA("BasePart") and c ~= root) then
weld(root, c);
c.Anchored = false;
elseif ( c:IsA("Model") ) then
recursiveWeld(root, c);
end
end
end
Not sure if this works but it looks exactly like what I remember.