Hello, I don’t know how to tween a part at a constant speed no matter the position of the end goal.
Here is an example
The elevator goes up really fast when it has to go up 2000 studs and it goes really slow when it has to go up 50 studs.
I want this to be a constant rate, so no matter if it is going to go 2000 studs in the air or 10 it will move at the same speed, how would I do this?
I have found no answers to this on dev forum.
Script (probably not necessary)
-- this gets triggered a lot of times per second, it detects when the player moves the lever
logisticPort.Powered.Changed:Connect(function(powered)
local MoveBy = logisticPort.MoveBy.Value -- cframe value
-- the important part
TweenService:Create(Main.Target,TweenInfo.new(2,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut),{CFrame = CFrame.new(MoveBy.Position.X * powered, MoveBy.Position.Y * powered, MoveBy.Position.Z * powered)}):Play()
end)
This is because you made it so that time is constant, v = s/t so if you increase the displacement then velocity will also increase. To keep velocity constant, you need to define a constant for velocity,