I need help with my conveyor belt Surface GUI system

What I’m trying to do is have a SurfaceGUI on a conveyor belt part that shows an Arrow/Arrows pointing and scrolling towards the same direction as the conveyor belts direction.


(I turned off Clipping to show how i want it to work)

The rotation of the image is working perfectly fine. The biggest issue I’m having is with the scrolling movement of the Arrow. I thought this would be easy for but but I’ve been trying to figure this out for days and I could never get it working properly.

I was able to get it working fine if the direction of the conveyor is in a single direction. When the conveyor is set to 2 directions though, it starts to not work as expected.

To set the position of the image, I’m using both the Position and the Anchor point to ensure that the ImageLabel reaches the exact edge of the UI before looping again if that makes sense.
Also, I’m using a Coroutine because I’m intending to apply this effect to multiple conveyor parts.

		local Texture = RS.Arrows:Clone()
		local Direction = part.AssemblyLinearVelocity.Unit
		local NewDirection = Vector3.new(Direction.Z,Direction.Y,Direction.X) --switch around direction to match same direction as image
		local _,RotY,_ = (CFrame.lookAt(part.Position,part.Position+(NewDirection*5))):ToOrientation() -- Get Rotation of the direction
		local Image:ImageLabel = Texture.ClipFix.Image
		
		Texture.Parent = part
		Image.Rotation = math.deg(RotY) -- Set rotation of image to face direction
        Image.Size = UDim2.new(1,500+(math.abs(RotY)*(700/630)),1,700-(math.abs(RotY)*(700/630))) -- Changes ImageLable size in accordance with the rotation.
		

		coroutine.wrap(function()
            local arrowSpeed = 0.01
            -- Formulas i came up with:
			-- (Direction+1)/2 : Shorten direction from (1 to -1) to (1 to 0)
			
			-- Direction+(-Direction*Offset) : Direction to 0
			-- Direction*Offset : 0 to Direction

			while true do -- Move Image into the direction of Conveyor belt
				local ShortPos = Vector2.new((NewDirection.X+1)/2,(NewDirection.Z+1)/2)

				for Offset = 0,1,arrowSpeed do	
					local FinalPos = Vector2.new(ShortPos.X*Offset, ShortPos.Y+(-ShortPos.Y*Offset))

					Image.Position = UDim2.fromScale(FinalPos.X,FinalPos.Y)
					Image.AnchorPoint = FinalPos
				end
			end
		end)()

Let me know how I can improve or make this work better! If you have any questions, feel free to ask me and i will try to answer the best of my knowledge.

You’re overthinking it, you don’t have to do any for this. Here’s how

1 Like

I have thought about using Beams. The reason why it wont work with what I’m trying to achieve is because I intend on displaying an array of arrows based on the parts size and with the CanvasGroups ClipsDescendants property. With that, I can make it so that the arrow can move in a sideways direction when having two directions on the Parts AssemblyLinearVelocity property.
example:

If you want to make the arrow move sideways cant you just add a conveyor at an angle and as such the arrows will follow it

Alright it took a painstakingly long time but i was finally able to make it work properly here is the result.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.