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

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

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

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.

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