AssemblyLinearVelocity cannot be assigned to

So i tried making a platform using a model I made that moves in one axis only with TweenService. It doesn’t go in a straight line it goes up and down a bit but overall a pretty simple platform. Now because its made using TS the player doesn’t move with it so I copied this script I saw online to make it work.

local function velocityCalc(t) -- t = platformModel:GetDescendants()
	for _,v in pairs(t) do
		if v:IsA("BasePart") then
			local lastpos = v.Position

			runService.Stepped:Connect(function(_, dt)
				local currentpos = v.Position
				local ds = currentpos - lastpos

				local v = ds / dt

				v.AssemblyLinearVelocity = v

				lastpos = currentpos
			end)
		end
	end
end

However, instead of working I’ve received this error for every single one of the parts:

AssemblyVelocityError

What can I do to get rid of the error and fix the problem?

I think the Velocity is a vector3 but your setting it to be an object

1 Like

Oh my god, I see it now, I set both the velocity vector and the value of the part of the array into the variable v so it got messed up this is hilarious. Thanks for pointing it out I don’t know why I couldn’t have seen it sooner.

1 Like

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