Henlo, I just followed a tutorial on how to make a conveyor, it did work, until later I frustated getting the code works for many conveyors inside 1 folder. I was looking many forums here and there to find a solutions for this, and I finally manage to adapt it to mine, after like 2 hours ![]()
This is the code from mine. I feel like the code might feel a bit too much because there is 2 usage of for loops. Is there any way to make it simplier? Or this one is already okay? I’m still a bit new at scripting.
local Workspace = game:GetService("Workspace")
local ConveyorFolder = Workspace:WaitForChild("ConveyorParts") --Folder for the conveyors.
local ConveyorParts = ConveyorFolder:GetChildren()
local function drag()
for _, conveyors in pairs(ConveyorParts) do
conveyors.AssemblyLinearVelocity = conveyors.CFrame.LookVector * 100
task.wait(0.1)
end
end
for _, conveyorPart in pairs(ConveyorParts) do
if conveyorPart:IsA("BasePart") then
conveyorPart.Touched:Connect(drag)
end
end