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

How to make after a certain amount of time a lighting variable will be enabled?

**The title kinda explains itself. I want it so that after a certain amount of time a color correction effect will be enabled for a couple secs. I'm also very new to scripting so it would be awesome if y'all could explain it to me and show me, thanks!

7 comments

0

do you mean you want it to toggle once after x amount of time or continously forever, also if you want it to be for everyone or specific player(s)

1

i want it to toggle after like 90000 seconds and then turn off after like 10 seconds. and yeah for everyone.

1

what the heck, 90000 seconds is 25 hours, u good?

0

lol yeah, its a really long waiting game

0

anyways, heres a solution: wait(90000) game.Lighting.ColorCorrection.Enabled = true wait(10) game.Lighting.ColorCorrection.Enabled = false lmao

0

wow. i feel stupid now

1 answer

script:

local part = script.Parent -- replace that with the location of the part
local time = 1 -- replace 1 with the amount of time in between
local sheep = false

local Color1 = Red -- replace red with what color you want it to change back to
local Color2 = Blue -- replace red with what color you want it to change to



while wait(time) do
	sheep = not sheep
	if sheep == true
		part.BrickColor = Enum.BrickColor[Color1]
	else
		part.BrickColor = Enum.BrickColor[Color2]
	end
end

another way script:

local part = script.Parent -- replace that with the location of the part
local time1 = 1 -- replace 1 with the amount of time in between
local time2 = 1 --replace 1 with the amount of time in between
local sheep = false

local Color1 = Red -- replace red with what color you want it to change back to
local Color2 = Blue -- replace red with what color you want it to change to


while wait()
	if sheep = true
		wait(time1)
		sheep = true
		part.BrickColor = Enum.BrickColor[Color1]
	else
		wait(time2)
		sheep = false
		part.BrickColor = Enum.BrickColor[Color1]
	end
end

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