Hello! I have this part tween. I wonder if there’s a better way to tween it or keep it like it is.
-- RunContext = Client
local ts = game:GetService("TweenService")
local info = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, -1, true, 3)
local Folder = script.Parent:GetChildren()
for i, MovingPlatform in pairs(Folder) do
if MovingPlatform:IsA("Model") or MovingPlatform:IsA("BasePart") then
local MoveHit = MovingPlatform:WaitForChild("MovingHit")
local Destination = MovingPlatform:WaitForChild("Destination")
local CF_Down = {
CFrame = CFrame.new(Destination.CFrame.X, Destination.CFrame.Y, Destination.CFrame.Z)
}
local DownTween = ts:Create(MoveHit, info, CF_Down)
DownTween:Play()
end
end
-- RunContext = Client
local ts = game:GetService("TweenService")
local info = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, -1, true, 3)
local Folder = script.Parent:GetChildren()
for i, MovingPlatform in pairs(Folder) do
if MovingPlatform:IsA("Model") or MovingPlatform:IsA("BasePart") then
local MoveHit = MovingPlatform:WaitForChild("MovingHit")
local Destination = MovingPlatform:WaitForChild("Destination")
local CF_Down = {
CFrame = CFrame.new(Destination.CFrame.X, Destination.CFrame.Y, Destination.CFrame.Z)
}
local DownTween = ts:Create(MoveHit, info, CF_Down)
DownTween:Play()
end
end
into this.
-- RunContext = Client
local Folder = script.Parent:GetChildren()
for i, MovingPlatform in pairs(Folder) do
if MovingPlatform:IsA("Model") or MovingPlatform:IsA("BasePart") then
local MoveHit = MovingPlatform:WaitForChild("MovingHit")
local Destination = MovingPlatform:WaitForChild("Destination")
game:GetService("TweenService"):Create(MoveHit, TweenInfo.new(TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, -1, true, 3), {CFrame = CFrame.new(Destination.CFrame.X, Destination.CFrame.Y, Destination.CFrame.Z)}:Play()
end
end
What did I do?
First, I deleted TweenInfo Variable “info” and instead just added whole tweenInfo inside Tween.
Second, I deleted Tween Variable “CF_Down” and instead just added whole table inside Tween.
Third, I deleted TweenBase Variable “DownTween” and instead just made non-variable Tween play.
This line is the non-variable TweenBase ( Line 7 )