ROBLOX really has to fix Tweens

Hello again.

I am @Vikko151, a mid-range developper which is working on a project. The problem is, I’m working on a fade on my game, made with a tween, but the tween isn’t showing, and my music becomes silent suddently instead of lowering slightly the volume over time : I don’t want to ask you directly help, but what surprised me is this :

Tweens not displayed - My old tween-related topic

Tween doesn’t play - Help and Feedback / Scripting Support - Developer Forum | Roblox

Why is my Tween not playing? - Help and Feedback / Scripting Support - Developer Forum | Roblox

We are much to have this problem, and nobody can answer us, and now, I should have released my big project called Gun Wars 3, but still stuck on the beginning due to this problem. And so I am asking something hard, and something harder :

1. Does ROBLOX has to fix tweens ?

Yes, and I think it is. I’m having this problem on 3 projects now and I still can’t receive an answer and can’t fix it alone. I can only do like in 2015, use RunService.RenderStepped to go on a position until it’s reached. Tweens are incredible, but this bug makes everything wrong. I don’t know why, but we are much that are coding well, but getting discouraged by this error coming from nowhere. Why peoples like @Maximum_ADHD, coders with experience, can tween without any problems and mid-range individual devs, like me, get the disfunctionment in the teeth.

2. Am I coding “bad” ?

I’m hoping it would be false, but it could. Mabye am I using wrong my tweens and make them going wrong, or something like. I’m having this on those 3 videos.

Code (a test for a game) :

local IntroEnded = false
local TimeRepeated = 4
local TS = game:GetService("TweenService")
local Ended = false

while wait(0) and Ended == false do
	if script.Parent.TimePosition >= 19.161 and IntroEnded == false then
		IntroEnded = true
	end
	if script.Parent.TimePosition <= 19.161 and IntroEnded == true then
		script.Parent.TimePosition = 19.161
		TimeRepeated = TimeRepeated + 1
		print("Repeat!")
	end
	if TimeRepeated == 5 then
		TimeRepeated = 0
		IntroEnded = false
		TS:Create(script.Parent, TweenInfo.new(5, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut,0,false,0), {Volume = 10})
		wait(5)
		print("End!")
		script.Parent:Stop()
		Ended = true
	end
	end

Video :

Code (I was less good, sorry for newbie script) :

local function MouseClickedButton(Button,CameraNumber)
	if IsClicking == true then return end
	IsClicking = true
	local Times = 0
	local BaseColor = Button.Parent.OutLine.BackgroundColor3
	Hovered = false
	Button.Parent.Parent.Parent.Parent.MessageBox.Message.Text = ""
	Button.Parent.OutLine.UIGradient.Offset = Vector2.new(0,0)
	TS:Create(Button.Parent.OutLine,TweenInfo.new(0.7,Enum.EasingStyle.Quad,Enum.EasingDirection.Out,0,false,0),{ BackgroundColor3 = Color3.new(0,255,0) } ):Play()
	TS:Create(Button.Parent.TextButton,TweenInfo.new(0.7,Enum.EasingStyle.Quad,Enum.EasingDirection.Out,0,false,0),{ BackgroundColor3 = Color3.new(0,255,0) } ):Play()
	Sounds.PressSound:Play()
	repeat
		Times = Times + 1
		if Times == 5 then
			TS:Create(Button.Parent.OutLine,TweenInfo.new(0.7,Enum.EasingStyle.Quad,Enum.EasingDirection.In,0,false,0),{ BackgroundColor3 = BaseColor } ):Play()
			TS:Create(Button.Parent.TextButton,TweenInfo.new(0.7,Enum.EasingStyle.Quad,Enum.EasingDirection.In,0,false,0),{ BackgroundColor3 = Color3.new(255,255,255) } ):Play()
		end
		TS:Create(Button.Parent.OutLine.UIGradient,TweenInfo.new(0.1,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0),{ Offset = Vector2.new(0,4) } ):Play()
		wait(0.1)
		Button.Parent.OutLine.UIGradient.Offset = Vector2.new(0,-4)
		TS:Create(Button.Parent.OutLine.UIGradient,TweenInfo.new(0.1,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0),{ Offset = Vector2.new(0,0) } ):Play()
		wait(0.1)
	until Times == 7
	TS:Create(StartScreen.Layer,TweenInfo.new(0.5,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0),{ BackgroundTransparency = 0 } )
	wait(1.1)
	MainFrame.Visible = false
	Camera.CameraSubject = Cameras.Camera2
	Camera.CameraType = "Scriptable"
	Camera.CFrame = Cameras.Camera2.CFrame
	TS:Create(StartScreen.Layer,TweenInfo.new(0.5,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0),{ BackgroundTransparency = 1 } ):Play()
	wait(1)
	IsClicking = false
end

Video :

If someone could help me, I would really appreciate !

Conclusion.

I need help for fixing one (or both) problems. If nothing is working, could someone ask for high-ranked to report this technical issue ? Thanks, and please, answer ASAP !

Best regards,

@Vikko151

Tweens are not broken and they work just fine

There are two things you should check when using tweens

  1. Tweens will be canceled if another tween affecting the same value is started
  2. Tweens often cannot tween certian things that are being changed, such as the camera
    so instead tween a nuumber value and in a renderstepped loop set the value based on the tweened number
1 Like

In both code examples, there are tweens which are created but never played. This is the problem with writing very long lines of code instead of breaking it apart into fragments. I personally make all of my tweens into separate variables so that I can easily see what is happening with each of them.

Hello, @noblemaxx !

oof

I forgot to put Play(). Why am I so foolish. Thanks you so much. I already fixed my first issue, and now it’s time to go on the second one. I will try @Sub2_AlteredMindYT, okay ? If you think it’s working, don’t forget to :heart: it’s messsage so it’s a proof which it’s true for next people.

Best regards,

@Vikko151

Okay, for the second problem.
First, did you remember to call the function? I don’t see that anywhere
Secondly,

You forgot to add do there and add end at the end (idk if it has an impact)
Next, the same exact problem as the first problem…

Tell me if it doesn’t work (which will likely be the case)

Hello, @neweve2323 !

Thanks for your answer. You know, I am basically french and I learnt Lua™ alone, so some expressions aren’t well known by me. So, I’m talking about it since I don’t really know about what you are calling :

It’s ridiculous from my part, I know. Autodidactical learning has it’s own consequences. Anyways, the other solutions you advised me were really a great help. Let’s hope you can explain me what does call the function means…

Sincerely,

@Vikko151

function DoSomething()
      -- Does Something
end


DoSomething() -- Runs (Calls) the function

If you are able to DM me I could probably help you fix the issue.

The problems in your script that you are not waiting for the TweenService to end.
When you start a new Tween it is going to run on the background and continue the code. From what I am seeing you are starting the tween,. waiting 5 seconds and then trying to stop it. However the object that you are stopping is not supposed to be script.Parent. You are supposed to stop the tween and not the object itself.
To do that you would have to do this:

if TimeRepeated == 5 then
		TimeRepeated = 0
		IntroEnded = false
		local Tween = TS:Create(script.Parent, TweenInfo.new(5, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut,0,false,0), {Volume = 10})
                Tween:Play()
		wait(5)
		print("End!")
		Tween:Stop()
		Ended = true
	end
	end

Also I suggest if you want to wait for the whole tween to play out don’t use wait(), instead use:

Tween.Completed:Wait()