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

Is There Any Errors In Toggling These BoolValues?

Asked by 4 years ago
function Safe()
    script.Parent.GreenOn.Value = true
    script.Parent.Parent.Part1.YellowOn.Value = false
    script.Parent.Parent.Part2.RedOn.Value = false
end

script.Parent.ClickDetector.MouseClick:Connect(Safe)

I've Gotten My System To Show A Response, But Not A Correct one

GOAL: Script That Is Activated (Should Repeat Itself Until Set False)

if script.Parent.Parent.Buttons.Part.GreenOn.Value == true then
    script.Parent.MeshPart.BrickColor = BrickColor.new("Lime green")
    script.Parent.MeshPart.Material = Enum.Material.Neon
    script.Parent.MeshPart1.BrickColor = BrickColor.new("Medium stone grey")
    script.Parent.MeshPart1.Material = Enum.Material.Glass
    wait(0.25)
    script.Parent.MeshPart.BrickColor = BrickColor.new("Medium stone grey")
    script.Parent.MeshPart.Material = Enum.Material.Glass
    script.Parent.MeshPart1.BrickColor = BrickColor.new("Lime green")
    script.Parent.MeshPart1.Material = Enum.Material.Neon
    wait(0.25)
end

2 answers

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

I think what you would need to do is check whenever the value is changed, then use a while loop to run that piece of code

script.Parent.Parent.Buttons.Part.GreenOn.Changed:Connect(function()
    while script.Parent.Parent.Buttons.Part.GreenOn.Value == true do
        script.Parent.MeshPart.BrickColor = BrickColor.new("Lime green")
        script.Parent.MeshPart.Material = Enum.Material.Neon
        script.Parent.MeshPart1.BrickColor = BrickColor.new("Medium stone grey")
        script.Parent.MeshPart1.Material = Enum.Material.Glass
        wait(0.25)
        script.Parent.MeshPart.BrickColor = BrickColor.new("Medium stone grey")
        script.Parent.MeshPart.Material = Enum.Material.Glass
        script.Parent.MeshPart1.BrickColor = BrickColor.new("Lime green")
        script.Parent.MeshPart1.Material = Enum.Material.Neon
        wait(0.25)
    end
end)

If I understand your question correctly this should work

0
Didn't Work, Turned On Another Set of lights JacoFluff 4 — 4y
0
I want to help too; I'm just bad at helping when I can't see the full source CodeProto 0 — 4y
Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

The explaination is not very clear to me, do you want to do this?

local GreenOn=script.Parent.Parent.Buttons.Part.GreenOn
local YellowOn=script.Parent.Parent.Buttons.Part1.YellowOn
local RedOn=script.Parent.Parent.Buttons.Part2.RedOn
local Part0,Part1=script.Parent.MeshPart,script.Parent.MeshPart1
while true do
    Part0.BrickColor=BrickColor.new("Medium stone grey")
    Part0.Material=Enum.Material.Glass
    if GreenOn.Value then
        Part1.BrickColor=BrickColor.new("Lime green")
    elseif YellowOn.Value then
        Part1.BrickColor=BrickColor.new("New Yeller")
    elseif RedOn.Value then
        Part1.BrickColor=BrickColor.new("Really red")
    end
    Part1.Material=Enum.Material.Neon
    wait(0.25)
    Part1.BrickColor=BrickColor.new("Medium stone grey")
    Part1.Material=Enum.Material.Glass
    if GreenOn.Value then
        Part0.BrickColor=BrickColor.new("Lime green")
    elseif YellowOn.Value then
        Part0.BrickColor=BrickColor.new("New Yeller")
    elseif RedOn.Value then
        Part0.BrickColor=BrickColor.new("Really red")
    end
    Part0.Material=Enum.Material.Neon
    wait(0.25)
end

Answer this question