Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 8 years ago

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

0
And I did miss and extra end at the end of the script, I'm aware of this BlackpoolTransport 0 — 8y
0
Help? BlackpoolTransport 0 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

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
0
Help please? BlackpoolTransport 0 — 8y
0
Not working BlackpoolTransport 0 — 8y
0
I've edited it to use a different method. Try now. Ali365Dash 0 — 8y
Ad

Answer this question