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

Why won't the parts change color when I change the value to 360?

Asked by 6 years ago
local Window = script.Parent.Window
local Doorhole = script.Parent.Doorhole


function Lightsoff()
    Window.BrickColor = BrickColor.new("Really black")
    Doorhole.BrickColor = BrickColor.new("Really black")
end

function Lightson()
    Window.BrickColor = BrickColor.new("CGA brown")
    Doorhole.BrickColor = BrickColor.new("CGA brown")
end

while true do
wait(.1)
    if game.Workspace.TimeInMinutes.Value == 1140 then 
Lightson()
    if game.Workspace.TimeInMinutes.Value == 360 then
Lightsoff()
    end
    end
end

If i set the value to 1140 it works fine, but does nothing when i set it to 360 Any idea?

1 answer

Log in to vote
0
Answered by 6 years ago
local Window = script.Parent.Window
local Doorhole = script.Parent.Doorhole


function Lightsoff()
    Window.BrickColor = BrickColor.new("Really black")
    Doorhole.BrickColor = BrickColor.new("Really black")
    print("Lights are off")
end

function Lightson()
    Window.BrickColor = BrickColor.new("CGA brown")
    Doorhole.BrickColor = BrickColor.new("CGA brown")
    print("Lights are on")
end

while true do
wait(.1)
    if game.Workspace.TimeInMinutes.Value == 1140 then 
Lightson()
    end
    if game.Workspace.TimeInMinutes.Value == 360 then
Lightsoff()
    end

end



Put an if statement inside an if statement by accident.

Ad

Answer this question