Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

For loops not working??

What is supposed to happen is when a player clicks a TextButton, a frame fades away.

Nothing happens.

The script:

local player = game.Players.LocalPlayer
local frame = player.PlayerGui.Intro.BackgroundFrame

script.Parent.MouseButton1Click:connect(function()
         for fade = 0, 1, +0.1 do -- every .1 second the frame fades out a little bit
               frame.BackgroundTransparency = fade
               wait(0.1)
          end
end

2 comments

1

Take away the + on the 0.1

0

Thanks! It works now.

1 answer

local frame = player.PlayerGui.Intro.BackgroundFrame

I'm not sure this won't work, but it's a bit redundant. Just put the script in the frame, then use script.Parent

for fade = 0, 1, +0.1 do

I doubt Lua will recognize + as a positive symbol and not an addition symbol. Just write the plain number, as in:

for fade = 0, 1, 0.1 do

This discussion is preserved as it was. New answers, comments, and votes are closed.