should i send code? ㅤ ㅤ ㅤ ㅤ ㅤ ㅤ ㅤ ㅤ ㅤ
im using the “rain plugin” but i made it disable and enable and used math.random to enable it at random timesㅤ ㅤ ㅤ ㅤ ㅤ ㅤ ㅤ ㅤ ㅤ ㅤ
Just give me the overall idea of your raining system
i just want the thunder to disable when its not raining and enable thunder when its raining
I think I get him now. He has a script that takes one of the many modules, and disables those which he doesn’t need, creating a randomizer rain system.
@Fyrex227 Correct if I am wrong, but it’s better if you sent the script - not the module, the Script.
Nevermind, I’m wrong.
I’m wrong, ignore this.
i got the thunder script from here Weather System [Open-Sourced] - Roblox ik it has a rain cycle system and stuff but i dont like the rain, i like the rain plugin more
here is my rain script (it has modules inside the local script too)
local Rain = require(script.Rain)
local Snow = script.SnowScript
local SnowScript = require(Snow.Snow)
Snow.Disabled = false
local TweenService = game:GetService(“TweenService”)
local part = game.Workspace. Terrain.Clouds
Rain:SetColor(Color3.fromRGB(script.Color.Value.x, script.Color.Value.y, script.Color.Value.z))
Rain:SetDirection(script.Direction.Value)
Rain:SetTransparency(script.Transparency.Value)
Rain:SetSpeedRatio(script.SpeedRatio.Value)
Rain:SetIntensityRatio(script.IntensityRatio.Value)
Rain:SetLightInfluence(script.LightInfluence.Value)
Rain:SetLightEmission(script.LightEmission.Value)
Rain:SetVolume(script.Volume.Value)
Rain:SetSoundId(script.SoundId.Value)
Rain:SetStraightTexture(script.StraightTexture.Value)
Rain:SetTopDownTexture(script.TopDownTexture.Value)
Rain:SetSplashTexture(script.SplashTexture.Value)
local threshold = script.TransparencyThreshold.Value
if script.TransparencyConstraint.Value and script.CanCollideConstraint.Value then
Rain:SetCollisionMode(
Rain.CollisionMode.Function,
function(p)
return p.Transparency <= threshold and p.CanCollide
end
)
elseif script.TransparencyConstraint.Value then
Rain:SetCollisionMode(
Rain.CollisionMode.Function,
function(p)
return p.Transparency <= threshold
end
)
elseif script.CanCollideConstraint.Value then
Rain:SetCollisionMode(
Rain.CollisionMode.Function,
function(p)
return p.CanCollide
end
)
end
function RainEnable()
Snow.Disabled = true
Snow.Transparency.Value = 1
local goal = {}
goal.Density = 1
goal.Cover = 1
local tweenInfo = TweenInfo.new(5)
local tween = TweenService:Create(part, tweenInfo, goal)
tween:Play()
task.wait(5) --how long u want it to start raining after the clouds have changed
Rain:Enable()
end
function RainDisable()
Snow.Disabled = false
Snow.Transparency.Value = 0
local goal = {}
goal.Density = 1
goal.Cover = 0.5
local tweenInfo = TweenInfo.new(5)
local tween = TweenService:Create(part, tweenInfo, goal)
tween:Play()
Rain:Disable()
end
while true do
task.wait(15) --how long before it can rain again
if (math.random(1,2) == 1) then RainEnable()
SnowScript:Disable()
task.wait(10) --how long it will rain
Snow.Disabled = false
local goal = {}
goal.Density = 1
goal.Cover = 0.5
local tweenInfo = TweenInfo.new(5)
local tween = TweenService:Create(part, tweenInfo, goal)
tween:Play()
Rain:Disable()
end
end
For this, use require(). You don’t really have to disable scripts for this since ModuleScripts will only run when required from a script.
Also please codeblock what you just sent. Wrap your code between ```.
What do you mean “disable” a module script? A ModuleScript isn’t something you “disable”; once you require()
it, everything in the module runs once, returning whatever it returns. If there’s a flag you wanna turn on/off inside the module, then I’d suggest doing that on the server without being asked to by the client; what’s the condition you want to handle for to disable the rain module?
this is the weather module and under it is the lighting spawner i think
here is weather module script:
local Lighting = game.Lighting
local TweenService = game:GetService(“TweenService”)
local Lightning = require(script.Lightning)
– Settings
local DayTimes = {
MinTime = 2;
MaxTime = 2;
}
local RainTimes = {
MinTime = 5;
MaxTime = 5;
}
local LightingStrikeTimes = {
MinTime = 5;
MaxTime = 5;
}
–
local Weather = {
FireDespawnTime = 20;
CurrentWeather = “Day”;
WeatherTimer = math.random(DayTimes.MinTime,DayTimes.MaxTime);
}
local TransitionTime = 12
local TweenFunction = function(Object,Goal,Time,EasingStyle,EasingDirection)
local Tween = TweenService:Create(
Object,
TweenInfo.new(
Time,
EasingStyle,
EasingDirection),
Goal)
spawn(function()
Tween:Play()
end)
end
EasingStyle = Enum.EasingStyle.Sine
EasingDirection = Enum.EasingDirection.Out
local RainLighting = {
Ambient = Color3.fromRGB(97, 106, 225);
Brightness = 1.48;
OutdoorAmbient = Color3.fromRGB(75, 98, 202);
FogColor = Color3.fromRGB(67, 83, 245);
FogEnd = 500;
}
local DayLighting = {
Ambient = Color3.fromRGB(255, 216, 168);
Brightness = 2.2;
OutdoorAmbient = Color3.fromRGB(156, 158, 214);
FogColor = Color3.fromRGB(165, 160, 245);
FogEnd = 2900;
}
local ChangeWeather = function(WeatherName,WeatherTable,OpositeWeatherName,WeatherLightingTable)
Weather.CurrentWeather = WeatherName
Weather.WeatherTimer = math.random( WeatherTable.MinTime, WeatherTable.MaxTime )
game.ReplicatedStorage.Remotes.Events.WeatherChanged:FireAllClients(WeatherName,WeatherTable,OpositeWeatherName,WeatherLightingTable)
end
function Weather:Rain()
if Weather.CurrentWeather ~= “Rain” then
ChangeWeather(“Rain”,RainTimes,“Day”,RainLighting)
end
end
function Weather:Day()
if Weather.CurrentWeather ~= “Day” then
ChangeWeather(“Day”,DayTimes,“Rain”,DayLighting)
end
end
game.ReplicatedStorage.Remotes.Functions.RequestWeatherData.OnServerInvoke = function()
local var2 = nil
local var3 = nil
local Lighting_1 = nil
if Weather.CurrentWeather == "Day" then
var2 = DayTimes
var3 = "Rain"
Lighting_1 = DayLighting
else
var2 = RainTimes
var3 = "Day"
Lighting_1 = RainLighting
end
return Weather.CurrentWeather,var2,var3,Lighting_1
end
Weather.StartCycle = function()
local function FireLightning()
while true do
task.wait()
if Weather.CurrentWeather == "Rain" then
task.wait(math.random(LightingStrikeTimes.MinTime,LightingStrikeTimes.MaxTime))
if Weather.CurrentWeather == "Rain" then
spawn(Lightning.Strike)
game.ReplicatedStorage.Remotes.Events.ImpactExplosion:FireAllClients("Lightning")
end
end
end
end
local function WeatherCycle()
while true do
task.wait(1)
Weather.WeatherTimer = Weather.WeatherTimer - 1
if Weather.WeatherTimer <= 0 then
if Weather.CurrentWeather == "Day" then
Weather:Rain()
else
Weather:Rain()
end
end
end
end
coroutine.wrap(WeatherCycle)()
coroutine.wrap(FireLightning)()
end
Weather.StartCycle()
return Weather
This is gonna be hard to read without codeblock…
as u can see it has the “rain” thing but i made the rain transparent cus i like the rain plugin’s rain more
Please answer my question, I don’t wanna be given code, I’d much prefer to help using words. So your goal is to disable the rain because your character is under shelter?
no i want to disable the thunder and enable the thunder when it rains
Sure. How do you know when it’s raining?
using my rain script ㅤ ㅤ ㅤ ㅤ ㅤ ㅤ ㅤ ㅤ ㅤ
i use “math.random” and a timer
thats why i wanna disable it somehow by adding a function in my rain cycle script
Which code block is the thunder in?
this is how it looks, lighting wont work without “weather”