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

How do I make fog show when a certain amount of values are on?

I am trying to make generators for a thing I'm making, and once they're all off I want the fog to appear so it's difficult to see. I have two scripts, one to turn it on and off.

I am a noob at scripting, so please go easy on me!

if 
	workspace.LightSwitch1.ValueR = true
	and
	workspace.LightSwitch2.ValueE = true
	and
	workspace.LightSwitch3.ValueF = true
	and
	workspace.LightSwitch4.ValueD = true
	then
	wait(2.5)
	script.parent.PowerOut.Play
wait()
	game.Lighting.FogEnd = ("50")
end

And

if 
	workspace.LightSwitch1.ValueR = false
	and
	workspace.LightSwitch2.ValueE = false
	and
	workspace.LightSwitch3.ValueF = false
	and
	workspace.LightSwitch4.ValueD = false
	then
	wait(.5)
	game.Lighting.FogEnd = ("999e999")
end

1 answer

if 
    workspace.LightSwitch1.ValueR = true
    and
    workspace.LightSwitch2.ValueE = true
    and
    workspace.LightSwitch3.ValueF = true
    and
    workspace.LightSwitch4.ValueD = true
    then
    wait(2.5)
    script.parent.PowerOut:Play()
wait()
    game.Lighting.FogEnd = 50
end
if 
    workspace.LightSwitch1.ValueR = false
    and
    workspace.LightSwitch2.ValueE = false
    and
    workspace.LightSwitch3.ValueF = false
    and
    workspace.LightSwitch4.ValueD = false
    then
    wait(.5)
    game.Lighting.FogEnd = 999999
end

4 comments

0

It doesn't work. On both scripts the first equal signs are underlined with red, btw I have another value called "value," so that might ruin it.

0

add ".Value" behind all the Value objects

0

I think you’re supposed to use “==“ on conditional statements instead of “=“. Just replace all the “=“ with “==“ in the “if then” statement.

0

yep

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