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

While true loop scrip not functioning as intended?

Asked by 5 years ago
while true do
    wait(0.03)
    if script.Parent.on == true then
        script.Parent.G1.a.Transparency = 0
        script.Parent.G1.a.SurfaceLight.Enabled = true
        script.Parent.right.Transparency = 0
        wait(0.05)
        script.Parent.G1.a.Transparency = 1
        script.Parent.G1.a.SurfaceLight.Enabled = false
        script.Parent.right.Transparency = 1
        wait(0.05)
        script.Parent.G1.a.Transparency = 0
        script.Parent.G1.a.SurfaceLight.Enabled = true
        script.Parent.right.Transparency = 0
        wait(0.05)
        script.Parent.G1.a.Transparency = 1
        script.Parent.G1.a.SurfaceLight.Enabled = false
        script.Parent.right.Transparency = 1
        script.Parent.G2.b.Transparency = 0
        script.Parent.G2.b.SurfaceLight.Enabled = true
        script.Parent.left.Transparency = 0
        wait(0.05)
        script.Parent.G2.b.Transparency = 1
        script.Parent.G2.b.SurfaceLight.Enabled = false
        script.Parent.left.Transparency = 1
        wait(0.05)
        script.Parent.G2.b.Transparency = 0
        script.Parent.G2.b.SurfaceLight.Enabled = true
        script.Parent.left.Transparency = 0
        wait(0.05)
        script.Parent.G2.b.Transparency = 1
        script.Parent.G2.b.SurfaceLight.Enabled = false
        script.Parent.left.Transparency = 1 
    end
end

I have this script. I am trying to make it so if on is true the following will run. It is not working in game and not listening at all. It also won't return any errors.

0
What is "on" supposed to be? NoahsRebels 99 — 5y

3 answers

Log in to vote
1
Answered by 5 years ago

Probably this: "script.Parent.on == true"

If you're checking if it exists, do: "script.Parent:FindFirstChild("on")" but if you're checking if a BoolValue's Value IS TRUE, do: "script.Parent.on.Value == true"

Ad
Log in to vote
0
Answered by 5 years ago

Silly mistake from me. :/

Log in to vote
0
Answered by
Zikelah 20
5 years ago
Edited 5 years ago

If you are defining a part(as in the on), == should work.

the if statement does not need to be there. classic should work

as in this

script.on == true

then at the end

script.on == true

Parent does need to be there

0
*at bottom code block, true is actually false Zikelah 20 — 5y

Answer this question