You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
Basically I’ve created the a roller coaster, and want it tweened. -
What is the issue? Include screenshots / videos if possible!
The tween doesn’t make it look smooth, it’s kind of chopping; the script -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve made the ServerScript and the module to return the Tween, But I wanted to see if theres any other options that might make it a bit smoother.
– Server Code.
local Currtime = .2
game.ReplicatedStorage.Power.Changed:Connect(function(p)
if p == true then
for i = 1,#Rails:GetChildren() do
if Rails["P"..tostring(i)].Color == Color3.fromRGB(27, 42, 53) then
Tween(Cart,Cart.Sel.CFrame,Rails["P"..tostring(i)].CFrame,TweenInfo.new(.5,Enum.EasingStyle.Linear,Enum.EasingDirection.In)):Play()
Currtime = .5
elseif Rails["P"..tostring(i)].Color == Color3.fromRGB(163, 162, 165) then
Tween(Cart,Cart.Sel.CFrame,Rails["P"..tostring(i)].CFrame,TweenInfo.new(.05,Enum.EasingStyle.Linear,Enum.EasingDirection.In)):Play()
Currtime = .05
end
wait(Currtime)
if game.ReplicatedStorage.Power.Value == false then
break
end
end
end
end)
– Module
local TweenService = game:GetService("TweenService")
return function(model,currentCFrame,goal,info)
local value = Instance.new("CFrameValue")
value.Value = currentCFrame
local tween = TweenService:Create(value,info,{Value = goal})
local connection
connection = value:GetPropertyChangedSignal("Value"):Connect(function()
if model.PrimaryPart then
model:SetPrimaryPartCFrame(value.Value)
else
connection:Disconnect()
end
end)
return tween
end