I can’t seem to figure out why Tween 2 for my script goes faster and higher, when it is the same as Tween 1 but opposite. Can anyone help?
(Tween 1 = Go Down, Tween 2 = Go Up)
if BlueCount > RedCount then
for i = 1, 32 do
local Info1 = TweenInfo.new(5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
local Goal1 = {CFrame = Flag[tostring(i)].CFrame * CFrame.new(0, -26.5, 0)}
local Tween1 = TweenService:Create(Flag[tostring(i)], Info1, Goal1)
local Info2 = TweenInfo.new(5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
local Goal2 = {CFrame = Flag[tostring(i)].CFrame * CFrame.new(0, 26.5, 0)}
local Tween2 = TweenService:Create(Flag[tostring(i)], Info2, Goal2)
-- Connect a completed event for the first tween
Tween1.Completed:Connect(function()
wait(5)
Flag[tostring(i)].TextureID = "rbxassetid://114480789"
Tween2:Play()
end)
Tween1:Play()
end
I mean, for one, you shouldn’t be looping this like that. It’s going to cause problems, in fact that’s likely to be part of the issue.
Edit: Also, you’re referencing the starting position in Tween2. You don’t need to multiply the CFrame, unless the Flag reference CFrame you’re using is at the bottom. It should just be Flag[tostring(i)].CFrame
Edit 2: Upon rewatching, the CFrame issue is your issue. Have a nice day/night.
The problem here is, you’re actually setting the flags CFrame 26.5 units above where it was in the beginning, which is obviously what you don’t want. I recommend just removing the:
* CFrame.new(0,26.5,0)
This should help to fix the issue. Here’s a very bad diagram of why this makes sense (seriously, excuse my drawing)