[SOLVED] When i do: "while true do" my studio almost crashes, everytime: Lag amount: 10 seconds

This bug is just too laggy man.

I wanted to do a Difficulty chart obby by me but unfortuanely my when i do “while true do” the thing is just instantly.

Image of the insane lag:

bandicam 2022-07-16 11-39-14-277

Video:

I died at the end xD.

At least 10k ms of lag. What the heck ?

The bug says this:

LocalScript:

script.Parent.Title.TextSize = 80
wait(2)
while true do
	script.Parent.Title.TextTransparency = 0.99 - script.Parent.Title.TextTransparency - 0.01
	repeat script.Parent.Title.TextTransparency = 0 - 0.01 until script.Parent.Title.TextTransparency == 0
end

All i wanted is make the “Shorten Module”.

Add task.wait() after while loop

2 Likes

Uhhh, you’re supposed to put a task.wait(n) inside of any while true do… How the heck does roblox even let you run that?

1 Like

You need to wait between the loops
while true do will repeat an infinite amount of times until it eventually crashes.
To fix this change it with while task.wait(0.001) do

I’ll try that !

Char limit.

It didn’t worked because it’s just too quick.

@LuigiLament It let me show a warning because the “n” is an Unknow global.

Sorry, I should’ve specified, n is shor t for number
for example

script.Parent.Title.TextSize = 80
wait(2)
while true do
        task.wait(0.1)
	script.Parent.Title.TextTransparency = 0.99 - script.Parent.Title.TextTransparency - 0.01
	repeat script.Parent.Title.TextTransparency = 0 - 0.01 until script.Parent.Title.TextTransparency == 0

end

also you really shouldnt be doing your script like this. Instead you could tween these properties which would be much easier, faster, and more efficient.

2 Likes

@InfiniteBlackPIX It’s just too quick.

It does 1,000 times a second.

But all i wanted is just 20 times a second but unfortuanely, your script doesn’t work.

1 Like

^ you’re not supposed to do while wait(n) do
instead you put the wait inside the loop.
Plus he should be using tweens for what he’s doing anyway. Not looping.

1 Like

What are u trying to do?

repeat script.Parent.Title.TextTransparency = 0 - 0.01 until script.Parent.Title.TextTransparency == 0
1 Like

Trying to make the Label slightly more visible by the time…

1 Like

U are trying to minus 0 by 0.01 for transparency??

1 Like

I fixed it to 0.99.

Char limit

1 Like

This isn’t a bug, @LuigiLament gave a solution that fixes the error you’re getting, if you edit the task.wait(n) it should give you your desired result.

Offhand question, but why aren’t you using a tween for this?

2 Likes

Won’t it just make the transparency 0.98?

1 Like

It’s not my script that’s broken, your script isn’t written correctly. You should be using tweens for this anyway

1 Like
while wait() do

end

and

while true do

    wait()
end

are the same thing.

1 Like

I removed the:

while true do

And the:

end

And the lag is still there.

1 Like