AssemblyLinearVelocity Doesn't Work

I am making an obby game. I made an ModuleScript that has a function called module.HandleBasisInstance() and whenever a BasePart is added to Workspace this function is fired.

This function tries to get attribute called “BasisType” and decide which function to fire.
Note: Functions are in a table so functions are fired in a table.

Each function has its own code but issue appears in the conveyor code. So I will only share the conveyor code.


BasisModule: ModuleScript - Conveyor Code

	["Conveyor"] = function(Part: BasePart)
		local ConveyorVelocity
		local VelocityMultiplier = 1

		local Attribute = Part:GetAttribute("BasisArguments")
		if Attribute and #Attribute >= 1 then
			ConveyorVelocity = Attribute["ConveyorVelocity"]
		end

		if not ConveyorVelocity or ConveyorVelocity == nil then
			ConveyorVelocity = 20
		end
		
		Part.AssemblyLinearVelocity = Part.CFrame.LookVector * 15
		print("\n\n" .. Part:GetFullName() .. "\n\nPart's LookVector: " .. tostring(Part.CFrame.LookVector) .. " (Part.CFrame.LookVector)\nWhat Velocity Should Be: " .. tostring(Part.CFrame.LookVector * 15) .. " (Part.CFrame.LookVector * 15)\nWhat Velocity Is: " .. tostring(Part.AssemblyLinearVelocity) .. " (Part.AssemblyLinearVelocity)")

		local ConveyorTexture: Texture
		if Part:FindFirstChild("ConveyorTexture") then
			ConveyorTexture = Part:FindFirstChild("ConveyorTexture")

			spawn(function()
				while task.wait(0.01) do
					ConveyorTexture.OffsetStudsV -= 0.1
				end
			end)
		end
	end

The issue appears in the line right before the print statement. It doesn’t give any errors or warns but it doesn’t work either.

Also the print statement prints the text below:

Workspace.Stages.stage8.Conveyors.conveyor

Part's LookVector: -0, -0, -1 (Part.CFrame.LookVector)
What Velocity Should Be: -0, -0, -15 (Part.CFrame.LookVector * 15)
What Velocity Is: 0, 0, 0 (Part.AssemblyLinearVelocity)

I don’t have any clue about this issue. A constantly live an issue that is some code work when published but not in Studio. But I also tried publishing and it was the same in Roblox.

I hope I can fix that.

1 Like

I’ve solved it myself. I just added a loop that constantly tries to set the Velocity until
velocity is set. I think this is caused by initializing the part so it needs some time to.

1 Like

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