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:
What can I do to get rid of the error and fix the problem?