Please format code properly.
This is your code right now.
while true do
workspace.Rain.RainEffect.RainScript.Enabled = false
workspace.Snow.SnowEffect.SnowScript.Enabled = false
do
math.random(1,2)
wait()
if math.random == 1 then
workspace.Rain.RainEffect.RainScript.Enabled = true
wait(160)
if math.random == 2 then
workspace.Snow.SnowEffect.SnowScript.Enabled = true
wait(160)
end
end
end
Now there are some obvious errors, such as you are missing an end. Also, you can use else instead of making another if statement. Also, you're comparing the function math.random to a number. Instead, you want to store the random number math.random generates, and compare that to a number.
(I'm assuming waiting 2 minutes and 40 seconds to perform the snow check is intentional)
You probably want to do something similar to this:
while true do
workspace.Rain.RainEffect.RainScript.Enabled = false
workspace.Snow.SnowEffect.SnowScript.Enabled = false
do
local num = math.random(1,2)
wait()
if num == 1 then
workspace.Rain.RainEffect.RainScript.Enabled = true
wait(160)
else
workspace.Snow.SnowEffect.SnowScript.Enabled = true
wait(160)
end
end
end
Reply with further questions,
and please mark as correct if this solution works for you!
2 comments
Honestly, the script was created to stop other scripts from running as one ran. Both script that were controlled by the main script contained a line that said wait(math.random(1,10)) as an example of random weather. This was made for uncertainty and non-constant weather. However, when the main script that controls the others is placed, the main script doesn't work.
When the RainScript and the SnowScript is taken out, then the main script works, but theirs no uncertainty. The other scripts: while true do script.Parent.Enabled = false --Particles off