Loop not ending

Currently this script isn’t working, it’s meant to stop when the TextTransparency(which is set to 1) reaches 0 however it just continues past 0 which also means that the BlurEffect just gets blurrier and blurrier. Does anyone know the reason as to why this is happening? I tried using > and == without combining them yet the loop still appears to endlessly continue.
Edit: Just added a variable. Nothing much.

    local Blur = Instance.new("BlurEffect")

        Blur.Parent = game.Lighting

        Blur.Size = 0

        Blur.Name = "Blur"
local PlaceName = script.Parent.PlaceName

        repeat

        wait(.3)

        PlaceName.TextTransparency = PlaceName.TextTransparency  - .1

        Blur.Size = Blur.Size +.4

        until 

        PlaceName.TextTransparency >= 0
2 Likes

Try this, just adjusted a few things:
Edit : Might not work because I don’t have enough info

local Blur=Instance.new("BlurEffect")
Blur.Name="Blur"
Blur.Size=0
repeat wait(0.3)
script.Parent.PlaceName.Text.Transparency=script.Parent.PlaceName.Text.Transparency-0.1
Blur.Size=Blur.Size+0.4
until
script.Parent.PlaceName.Text.Transparency ==0

When putting code on the forum, can you put “```lua” (and a new line) before it and “```” after it? It makes it easier to read and respects indentation properly.

1 Like
    local PlaceName = script.Parent.PlaceName

    local Blur=Instance.new("BlurEffect")

    Blur.Name="Blur"

    Blur.Size = 0

    Blur.Parent = game.Lighting

    repeat

    wait(0.3)

    PlaceName.TextTransparency = script.Parent.PlaceName.TextTransparency-0.1

    Blur.Size = Blur.Size + 0.4

    until

    PlaceName.TextTransparency == 0

This isn’t working since it’s still looping without stopping. (Also fixed some things. I tried it with the version you did just in-case I was unaware of something and it didn’t work.) regardless, this solution didn’t work with/without the edited version.

My apologies. I’ll fix that now.

1 Like

Alright happy coding! :cowboy_hat_face:

By that do you mean that it does nothing, or that it goes into negative transparency? This script works for me with that change.

The blur goes into extreme blur(10+) and the text transparency does go into negative transparency.
This is it with the script(Sorry for any typos at the moment. Having an unusual amount at the moment because I’m tired.)

Local PlaceName = script.Parent.PlaceName

    local Blur=Instance.new("BlurEffect")

    Blur.Name="Blur"

    Blur.Size = 0

    Blur.Parent = game.Lighting

    repeat

    wait(0.3)

    PlaceName.TextTransparency = script.Parent.PlaceName.TextTransparency-0.1

    Blur.Size = Blur.Size + 0.4

    until

    PlaceName.TextTransparency == 0

image

image

Oh, I see what the issue is. Your TextTransparency is probably not quite zero (I got -0.000000073015691270938987145200371742248535156250 when I tested it again, see floating-point error), so it doesn’t pass the condition. Instead, you should check if it’s zero or less than zero, and just set it to zero afterwards. You can check if it’s less than or equal to zero by doing until PlaceName.TextTransparency <= 0, which is the opposite of what you originally had.

1 Like

Thank you! This worked and I greatly appreciate it. (:

1 Like