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.