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

I need to put a wait () but I'm not sure where, could someone possibly help?

Ive got a script, and I believe everything is okay with it, the thing is. I've been told I need a wait time before triggering the flashtime but like I dont understand.

local Frame = script.Parent
local gui = script.Parent.Parent
function flashfunc()
local i = 1
repeat
    flashtimes()
    flashtimes()
    flashtimes()
    flashtimes()
    flashtimes()
until i == 1

gui.Enabled = false
end

function flashtimes()
    Frame.BackgroundColor3 = Color3.fromRGB(255,255,255)
    wait(0.1)
    Frame.BackgroundColor3 = Color3.fromRGB(0,0,0)
    wait(0.1)
end

1 comment

0

you shouldn't define a function after you use it

2 answers

You need to put waits into the repeat loop, put wait after every flashtimes(). If you want this infinite loop, use bigger waits like wait(0.5), or a second, because that will lag the server.

2 comments

0

it's called "FLASHtimes" because he wants it to FLASH between white and black before it disappears

0

:d sorry.. Edited the whole answer now.

Oh crap. I forgot the main part of the script when I was helping you!

local Frame = script.Parent
local gui = script.Parent.Parent
function flashfunc()
local i = 5--//1 = 1 Second or 5 = 5 Seconds
repeat
    flashtimes()
    flashtimes()
    flashtimes()
    flashtimes()
    flashtimes()
i = i - 1 --//now the countdown will work properly
until i == 0

gui.Enabled = false
end

function flashtimes()
    Frame.BackgroundColor3 = Color3.fromRGB(255,255,255)
    wait(0.1)
    Frame.BackgroundColor3 = Color3.fromRGB(0,0,0)
    wait(0.1)
end

Now the script will flash for as long as you set i.

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