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

How do you get a loop script to activate using a BoolValue?

Dear Scripting Helpers community,

I am writing to you today because of something I have been trying to figure out on my own, but I couldn't. I'm trying to make a loopable flashing light that activates using a BoolValue. I am asking for someone to support me. If someone could help me, that would be greatly appreciated. If this isn't possible using a BoolValue, please could you list another way of activating it simalar to a BoolValue.

Here is the code that is most likely to be causing the issue -

while true do
if script.Parent.Value == true then
	script.Parent.Parent.light1.Transparency = "0"
	script.Parent.Parent.light2.Transparency = "0"
	script.Parent.Parent.light3.Transparency = "0.5"
	script.Parent.Parent.light4.Transparency = "0.5"
	wait (1)
	script.Parent.Parent.light1.Transparency = "0.5"
	script.Parent.Parent.light2.Transparency = "0.5"
	script.Parent.Parent.light3.Transparency = "0"
	script.Parent.Parent.light4.Transparency = "0"
	
else script.Parent.Parent.light1.Transparency = "0.5"
	script.Parent.Parent.light2.Transparency = "0.5"
	script.Parent.Parent.light3.Transparency = "0.5"
	script.Parent.Parent.light4.Transparency = "0.5"
end

Thanks alot

BlackpoolTransport and the Nottinghamshire team

2 comments

0

And I did miss and extra end at the end of the script, I'm aware of this

0

Help?

1 answer

Forgot the end for the while true do script?

Change it to this:

while script.Parent.Value == true do
	script.Parent.Parent.light1.Transparency = "0"
	script.Parent.Parent.light2.Transparency = "0"
	script.Parent.Parent.light3.Transparency = "0.5"
	script.Parent.Parent.light4.Transparency = "0.5"
	wait (1)
	script.Parent.Parent.light1.Transparency = "0.5"
	script.Parent.Parent.light2.Transparency = "0.5"
	script.Parent.Parent.light3.Transparency = "0"
	script.Parent.Parent.light4.Transparency = "0"
end

while script.Parent.Value == false do
	script.Parent.Parent.light1.Transparency = "0.5"
	script.Parent.Parent.light2.Transparency = "0.5"
	script.Parent.Parent.light3.Transparency = "0.5"
	script.Parent.Parent.light4.Transparency = "0.5"
end

3 comments

0

Help please?

0

Not working

0

I've edited it to use a different method. Try now.

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