Hello everyone!
I’m trying to fix this script that makes a part follow nodes using CFrame smoothly. My issue is that the moving between the parts is often jittery. I’m assuming its because it doesn’t move to the next part until the CFrame is EXACTLY the CFrame of the goal. I was hoping to somewhat make it round off the CFrame if this is possible. I’m not super advanced when it comes to these types of things.
I would like to point out that the script is running entirely on the server, and not the client. Here’s the script:
local part = script.Parent
local coaster = game.Workspace.Coaster2
local TweenService = game:GetService("TweenService")
part.CFrame = coaster[1].CFrame
while true do
local tweenInfo = TweenInfo.new(
(script.Speed.Value), -- Time
Enum.EasingStyle.Linear, -- EasingStyle
Enum.EasingDirection.InOut -- EasingDirection
)
if part.CFrame == coaster[script.CurrentNumber.Value].CFrame then
if coaster:FindFirstChild(script.CurrentNumber.Value+1) then
script.CurrentNumber.Value = script.CurrentNumber.Value+1
end
local tween = TweenService:Create(part, tweenInfo, {CFrame = coaster[script.CurrentNumber.Value].CFrame})
tween:Play()
elseif not coaster:FindFirstChild(script.CurrentNumber.Value+1) then
script.CurrentNumber.Value = 1
local tween = TweenService:Create(part, tweenInfo, {CFrame = coaster[script.CurrentNumber.Value].CFrame})
tween:Play()
end
wait(0)
end
If anyone knows any possible solutions or could point me in the right direction, that’d be very much appreciated. Thanks in advance!
