Is there any way to have certain parts be affected by AssemblyLinearVelocity more?

So currently in my game I have one of those simple conveyor belts setup, ie. the ones where you make a parts linearassemblyvelocity set to the speed and direction you want a part to move in

What do I want to achieve: Ideally id like to have certain parts be affected by the linear velocity more, say I have an object that is “lighter” I would like it to zip down the conveyor belt 2x faster

What is the issue: I cant seem to find the proper setting on a part to make this happen. The best thing ive got is putting a script on said part and manually making part.AssemblyLinearVelocity = Vector3.new(0,0,-36) - which works for a split second but then it reverts to the assemblylinearvelocity

What ive tried: Ive tried changing the assemblymass which seems to do nothing, ive tried making the part massless, ive tried playing with the physical properties but nothing appears to work. I really dont want to make a while loop and constantly set the velocity but i guess ill have to if theres no other way

It would not be physically accurate to have lighter objects travel faster on a single platform that is moving at a uniform speed. I can’t think of many convenient ways to approach your problem, but I would personally avoid imparting a velocity on the conveyor. Instead, you would impart the velocity onto the objects on the conveyor with respect to the conveyor and the function for increasing velocity based on weight

Tested this and it works, and is better than using a script in each part.

local conveyor = script.Parent

-- Configure speeds for parts based on their names
local SpeedOfParts = {
	["Fast"] = Vector3.new(10, 0, 0),
	["Slow"] = Vector3.new(2, 0, 0),  
}

local partsOnConveyor = {}

local function applyVelocity(part)
	if part:IsA("BasePart") and part.CanCollide then
		local speed = SpeedOfParts[part.Name]
		part.AssemblyLinearVelocity = speed
	end
end

local function resetVelocity(part)
	if part:IsA("BasePart") then
		part.AssemblyLinearVelocity = Vector3.zero
	end
end

conveyor.Touched:Connect(function(otherPart)
	if not partsOnConveyor[otherPart] then
		partsOnConveyor[otherPart] = true
		applyVelocity(otherPart)
	end
end)

conveyor.TouchEnded:Connect(function(otherPart)
	if partsOnConveyor[otherPart] then
		partsOnConveyor[otherPart] = nil
		resetVelocity(otherPart)
	end
end)

game:GetService("RunService").Stepped:Connect(function()
	for part in pairs(partsOnConveyor) do
		if part.Parent then
			applyVelocity(part) 
		else
			partsOnConveyor[part] = nil 
		end
	end
end)

Hopefully this helps.

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