Automatic Conveyor Script not working

  1. What do you want to achieve? Keep it simple and clear!
    I want to make a script that turns BaseParts into conveyor belts, free of any work.

  2. What is the issue? Include screenshots / videos if possible!
    It isn’t universal. The attachments I am using are not relative to orientation, and I need them to calculate their own Positions using LookVector. I do believe I should be using LookVector, but I’m not sure.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I actually searched for options for so long I gave up on the idea for a couple of months, until now. I searched the Devforums, Tutorials in CFrame, and scripthelpers.org

local Att1 = Instance.new("Attachment",script.Parent)
Att1.Name = 'Att1'
Att1.Position = Vector3.new(-script.Parent.Size.X/2,script.Parent.Size.Y/2,0)
Att1.Visible = true -- For debug purposes

local Att2 = Instance.new("Attachment",script.Parent)
Att2.Name = 'Att2'
Att2.Position = Vector3.new(script.Parent.Size.X/2,script.Parent.Size.Y/2,0)
Att2.Visible = true -- For debug purposes

local CS = 100

local function setVelocity()
	local direction = Att1.WorldPosition - Att2.WorldPosition

	local conveyorVelocity = direction.Unit * CS
	script.Parent.AssemblyLinearVelocity = conveyorVelocity
end

script.Parent:GetPropertyChangedSignal("Orientation"):Connect(setVelocity)
setVelocity()
print('Auto Conveyor Script made by illuminati6767')
1 Like

You can make parts into conveyors by anchoring the parts and setting their AssemblyLinearVelocity and AssemblyAngularVelocity

if thats what your looking for

edit: it also has a script thats basically the same thing

local conveyor = script.Parent
 
local attStart = conveyor:FindFirstChild("AttStart")
local attEnd = conveyor:FindFirstChild("AttEnd")
 
local function setVelocity()
	local direction = attEnd.WorldPosition - attStart.WorldPosition
 
	local conveyorVelocity = direction.Unit * conveyor:GetAttribute("ConveyorSpeed")
	conveyor.AssemblyLinearVelocity = conveyorVelocity
end
 
conveyor:GetAttributeChangedSignal("ConveyorSpeed"):Connect(setVelocity)
conveyor:GetPropertyChangedSignal("Orientation"):Connect(setVelocity)
setVelocity()
2 Likes

Thanks, but I wanna make it automatic, the problem is that the attachments don’t face the front of the part

1 Like