Conveyor Rotation Error

Well, you could send the newer version of the conveyor code here, I would set it up for you.
Because it’s hard to help without seeing the new version.

Here

function Conveyor(O)
	
	if O.Name ~= "Conveyor" then return end
	if not O:IsA("Part") then return end
	if not O.Parent or not O:WaitForChild("Texture") or not O:WaitForChild("Speed") then return end
	
	O.Velocity = O.CFrame.lookVector * O.Speed.Value
	
	local Stage = O.Parent.Parent.Parent
	local Rotation = Stage:FindFirstChild("Rotation")
	
	if Rotation.Value == 180 then
		O.Velocity = O.CFrame.lookVector * O.Speed.Value
	else
		O.Velocity = O.CFrame.lookVector * -O.Speed.Value
	end
end

game.Workspace.DescendantAdded:Connect(Conveyor)

for _, v in pairs(game.Workspace:GetDescendants()) do
	
	Conveyor(v)
end

Uhm sorry, but could you tell me where the Stage Folder which contains all the stages is located, example:
ReplicatedStorage → Stages

It’s contained in ServerStorage.

Alr, are the stages inside of a folder or model ? If so, what’s its name.

The stages are in a folder named “Stages”.

I believe this is what you’re looking for:

function Conveyor(O)

	if O.Name ~= "Conveyor" then return end
	if not O:IsA("Part") then return end
	if not O.Parent or not O:WaitForChild("Texture") or not O:WaitForChild("Speed") then return end

	O.Velocity = O.CFrame.lookVector * O.Speed.Value

	local StageFolder = game:GetService("ServerStorage"):WaitForChild("Stages")


	local Stage = O.Parent.Parent.Parent -- It will change it later on, this is just the default one
	if StageFolder:FindFirstChild(O.Parent.Name) then -- First Parent
		StageFolder = O.Parent
	elseif StageFolder:FindFirstChild(O.Parent.Parent.Name) then -- Second Parent
		StageFolder = O.Parent.Parent
	elseif StageFolder:FindFirstChild(O.Parent.Parent.Parent.Name) then -- Third Parent
		StageFolder = O.Parent.Parent.Parent
	end
	local Rotation = Stage:FindFirstChild("Rotation")

	if Rotation.Value == 180 then
		O.Velocity = O.CFrame.lookVector * O.Speed.Value
	else
		O.Velocity = O.CFrame.lookVector * -O.Speed.Value
	end
end

game.Workspace.DescendantAdded:Connect(Conveyor)

for _, v in pairs(game.Workspace:GetDescendants()) do

	Conveyor(v)
end
1 Like