Hey, pretty much the title.
I’m trying to create a function that would check the speed of a moving part, with any sort of method that’s moving the part.
Thanks in advanced!
Hey, pretty much the title.
I’m trying to create a function that would check the speed of a moving part, with any sort of method that’s moving the part.
Thanks in advanced!
Oh interesting, How’d that work? if you don’t mind me asking
BasePart.AssemblyLinearVelocity
will return the linear velocity vector of the BasePart’s assembly. It’s the rate of change in position of the assembly’s center of mass in studs per second.
https://developer.roblox.com/en-us/api-reference/property/BasePart/AssemblyLinearVelocity
speed is distance / time so the function would take at least 0.1 seconds to return a value.
try returning the magnitude between two positions that a part is in at different times.
function partSpeed(part)
local pos = part.Position
wait(0.1)
return (part.Position - pos).magnitude
end
Ah I see I see, thank you very much.