BoolValues withing script trouble

I need support with this…

script.Parent.TextLabel.Text = "Round starting."
		wait(0.1)
		local started = true

Later on in the script…

if started == true then
	script.Parent.Darkness.BackgroundTransparency = 1
	wait(0.1)
	script.Parent.Darkness.BackgroundTransparency = 0.9
	wait(0.1)
	script.Parent.Darkness.BackgroundTransparency = 0.8
	wait(0.1)
	script.Parent.Darkness.BackgroundTransparency = .7
	wait(0.1)
	script.Parent.Darkness.BackgroundTransparency = .6
	wait(0.1)
	script.Parent.Darkness.BackgroundTransparency = .5
	wait(0.1)
	script.Parent.Darkness.BackgroundTransparency = .4
	wait(0.1)
	script.Parent.Darkness.BackgroundTransparency = .3
	wait(0.1)
	script.Parent.Darkness.BackgroundTransparency = .2
	wait(0.1)
	script.Parent.Darkness.BackgroundTransparency = .1
	wait(0.1)
	script.Parent.Darkness.BackgroundTransparency = 0
	wait(0.1)
	script.Parent.Darkness.BackgroundTransparency = 0
	wait(0.1)
	script.Parent.Darkness.BackgroundTransparency = 0
	wait(0.1)
	script.Parent.Darkness.BackgroundTransparency = 0
	wait(0.1)
	script.Parent.Darkness.BackgroundTransparency = 0
	wait(0.1)
	script.Parent.Darkness.BackgroundTransparency = 0
	wait(0.1)
	script.Parent.Darkness.BackgroundTransparency = 0.1
	wait(0.1)
	script.Parent.Darkness.BackgroundTransparency = 0.2
	wait(0.1)
	script.Parent.Darkness.BackgroundTransparency = 0.3
	wait(0.1)
	script.Parent.Darkness.BackgroundTransparency = 0.4
	wait(0.1)
	script.Parent.Darkness.BackgroundTransparency = 0.5
	wait(0.1)
	script.Parent.Darkness.BackgroundTransparency = 0.6
	wait(0.1)
	script.Parent.Darkness.BackgroundTransparency = 0.7
	wait(0.1)
	script.Parent.Darkness.BackgroundTransparency = 0.8
	wait(0.1)
	script.Parent.Darkness.BackgroundTransparency = 0.9
	wait(0.1)
	script.Parent.Darkness.BackgroundTransparency = 1
end

The transparency won’t change.

At the start of the script:

local started = false

It won’t work… Please help!

did you change the value in the middle or does the 2 part of the script just not get to run at all? also please use a for statement instead of doing that wait mess, itll just be much cleaner

Sorry I am very new learning scripting, how. sorry

local started = nil
script.Parent.TextLabel.Text = "Round Starting..."
wait(0.1)
started = true

for i = 1, 0, .1 do
    script.Parent.Darkness.BackgroundTransparency = i
end
for i = 0, 1, .1 do
    script.Parent.Darkness.BackgroundTransparency = i
end

Alright that should work. Good luck!

Thanks, hopefully it does
:grin:

The backgroundtransparancy continues… if started == true then
script.Parent.Darkness.BackgroundTransparency = 1
wait(0.1)
script.Parent.Darkness.BackgroundTransparency = 0.9
wait(0.1)
script.Parent.Darkness.BackgroundTransparency = 0.8
wait(0.1)
script.Parent.Darkness.BackgroundTransparency = .7
wait(0.1)
script.Parent.Darkness.BackgroundTransparency = .6
wait(0.1)
script.Parent.Darkness.BackgroundTransparency = .5
wait(0.1)
script.Parent.Darkness.BackgroundTransparency = .4
wait(0.1)
script.Parent.Darkness.BackgroundTransparency = .3
wait(0.1)
script.Parent.Darkness.BackgroundTransparency = .2
wait(0.1)
script.Parent.Darkness.BackgroundTransparency = .1
wait(0.1)
script.Parent.Darkness.BackgroundTransparency = 0
wait(0.1)
script.Parent.Darkness.BackgroundTransparency = 0
wait(0.1)
script.Parent.Darkness.BackgroundTransparency = 0
wait(0.1)
script.Parent.Darkness.BackgroundTransparency = 0
wait(0.1)
script.Parent.Darkness.BackgroundTransparency = 0
wait(0.1)
script.Parent.Darkness.BackgroundTransparency = 0
wait(0.1)
script.Parent.Darkness.BackgroundTransparency = 0.1
wait(0.1)
script.Parent.Darkness.BackgroundTransparency = 0.2
wait(0.1)
script.Parent.Darkness.BackgroundTransparency = 0.3
wait(0.1)
script.Parent.Darkness.BackgroundTransparency = 0.4
wait(0.1)
script.Parent.Darkness.BackgroundTransparency = 0.5
wait(0.1)
script.Parent.Darkness.BackgroundTransparency = 0.6
wait(0.1)
script.Parent.Darkness.BackgroundTransparency = 0.7
wait(0.1)
script.Parent.Darkness.BackgroundTransparency = 0.8
wait(0.1)
script.Parent.Darkness.BackgroundTransparency = 0.9
wait(0.1)
script.Parent.Darkness.BackgroundTransparency = 1
end

Do I do the

for i = ...

for every one??? Is there a way to just make it cleaner

Uh what do you mean? I don’t get your problem.

if i understand what youre saying do you have another gui overlapping it causing it to not change?

no gui overlapping :face_with_raised_eyebrow: :face_with_raised_eyebrow: :face_with_raised_eyebrow:

if started == true then
	for i = 1, 0, .1 do
		script.Parent.Darkness.BackgroundTransparency = i
	end
	for i = 0, 1, .1 do
		script.Parent.Darkness.BackgroundTransparency = i
	end
	for i = 1, 2, .1 do
		script.Parent.Darkness.BackgroundTransparency = i
	end
	for i = 0, 3, .1 do
		script.Parent.Darkness.BackgroundTransparency = i
	end
	for i = 1, 4, .1 do
		script.Parent.Darkness.BackgroundTransparency = i
	end
	for i = 0, 5, .1 do
		script.Parent.Darkness.BackgroundTransparency = i
	end
	for i = 1, 6, .1 do
		script.Parent.Darkness.BackgroundTransparency = i
	end
	for i = 0, 7, .1 do
		script.Parent.Darkness.BackgroundTransparency = i

Sorry I can’t figure it out.

Is this correct?

for loops are formatted as for I -the variable = 0 - start number, 1 - end number, .1 - increment number do
so if you have a for loop like for I = 1, 0, .1 do
it just wont run since it has no way to reach the end variable

Can you explain that please. I don’t get this

this will explain it better

I will read up on this. Thanks!

1 Like

how would I write this?

script.Parent.TextLabel.Text = "Enough players! Starting in timeremaining"

I couldn’t do the above, because it would say, “Starting in timeremaining”

script.Parent.TextLabel.Text = "Enough players! Starting in "..tostring(YourTimeValue)

Thanks! I will try this now! :laughing: