AssemblyLinearVelocity is not working for tycoon conveyer script

I’m working on a script that handles velocity for conveyers within my tycoon.

I’ve tested this method before, and it works fine, as you can see here.
Here’s the script I use to run this. Said script is in a model with the conveyer parts that I want to be able to move bricks.

local speed = 12

for parent,conveyer in pairs(script.Parent:GetChildren()) do
	if conveyer:IsA("Script") then return end
	if conveyer.Name == "aux" then
		conveyer.AssemblyLinearVelocity = -(conveyer.CFrame.RightVector)*speed
	else
		conveyer.AssemblyLinearVelocity = conveyer.CFrame.RightVector*speed
	end
end

However, in my tycoon, the AssemblyLinearVelocity never changes, at all. I don’t know why. I thought it was because everything in the tycoon was parented via folders, based on what I read here, so I switched to regular models, but nothing changed.

Thew way my tycoon works is the module script for it detects when the conveyer blocks are added as a descendant of the tycoon model, and then it is supposed to set its AssemblyLinearVelocity appropiately, as seen here:

local speed = 12
--- missing a lot of code, but it is not relevant to the issue.
self.objects.purchased.DescendantAdded:Connect(function(newChild)
		if newChild.Name == "auxC" then
			print("added")
			newChild.AssemblyLinearVelocity = -(newChild.CFrame.RightVector)*speed
		elseif newChild.Name == "mainC" then
			newChild.AssemblyLinearVelocity = newChild.CFrame.RightVector*speed	
		end
	end)

The code runs, as it prints “added,” but the velocity never changes, as seen here. There is no error logged to the console/output, so I have no idea what is going on.

I have tried a plethora of different methods with AssemblyLinearVelocity, but nothing works. I have tried working with the LinearObject property but I am new with it and that didn’t work either. I am thinking about using the depreciated BodyMovers for this issue since their “replacements” are a PITA to work with, but before I do that, I want to know what else can be done with AssemblyLinearVelocity before I take that option.

Update on this thread, what ended up fixing it was adding a “task.wait(.25)” to the code, where the “print(“added”)” statement is / before I did anything to the AssemblyLinearVelocity. I guess ROBLOX processed the AssemblyLinearVelocity before the newChild actually got into Workspace, causing an issue, or something of the like.

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