How do i disable a module script using a local script (this went off topic, there is no actual solution for "disabling" a module script)

So your thunder is in the Lightning module?

i think that is the thunder spawner and weather is telling when to enable “lighting” i think something like that

this is weather script ㅤ ㅤ ㅤ ㅤ ㅤ ㅤ ㅤ ㅤ ㅤ

this is lightning script:
local Lightning = {}

local folder = workspace:FindFirstChild(“LightningDebris”) or Instance.new(“Folder”,workspace)
folder.Name = “LightningDebris”
local TweenService = game:GetService(“TweenService”)
local TeleportService = game:GetService(“TeleportService”)

local function TweenTransparency(object,goal)
spawn(function()
local newtween = TweenService:Create(
object,
TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.Out),
goal
)
newtween:Play()
task.wait(2)
object:Destroy()
end)
end

local function ShootElectrode(from,too)
local lastpos = from
local steps = 80
local off = 5
local range = 500
local distance = (from-too).Magnitude
if distance > range then
distance = range
end
for i = 0,distance,steps do
local from = lastpos
local offset = Vector3.new(
math.random(-off,off),
math.random(-off,off),
math.random(-off,off)
)
local too = from + -(from-too).unit*steps + offset
local canbetouched = true
local strickedplayers = {}
local p = game.ReplicatedStorage.Assets.WeatherAssets.Electrode:Clone()
p.Parent = folder
p.Size = Vector3.new(p.Size.x,p.Size.y,(from-too).Magnitude)
p.CFrame = CFrame.new(from:Lerp(too,0.5),too)

	p.Touched:Connect(function(Hit)
		if Hit.Parent:FindFirstChild("Humanoid") then
			local char = Hit.Parent
			if p.Transparency <= 0.3 then
				Hit.Parent:WaitForChild("Humanoid"):TakeDamage(Hit.Parent:WaitForChild("Humanoid").MaxHealth)
			end
		end
	end)

	TweenTransparency(p,{Transparency = 1})
	lastpos = too
end

end

local abovegounrd2studs = 200
local makerayvisible = function(ray)
local midposint = ray.Origin + ray.Direction/2

local rock = Instance.new("Part",workspace)
rock.Anchored = true
rock.CanCollide = false
rock.Size = Vector3.new(0.5,0.5,ray.Direction.Magnitude)
rock.CFrame = CFrame.new(midposint, ray.Origin)
rock.Color = Color3.fromRGB(73, 89, 240)

end

local LightningStrike = function(base)

local rock = Instance.new("Part",workspace)
rock.Transparency = 1
rock.Anchored = true
rock.CanCollide = false
rock.Size = Vector3.new(0.1,0.1,0.1)
local ran = Random.new(tick())
local halfSize = base.Size * .5
local objPos = Vector3.new(ran:NextNumber(-halfSize.X, halfSize.X), 400, ran:NextNumber(-halfSize.Z, halfSize.Z))
rock.CFrame = CFrame.new(base.CFrame * objPos)
local x = rock.Position.X
local z = rock.Position.Z
local NewRay = Ray.new(rock.Position,Vector3.new(0,-700,0))

local IgnoredItems = {base}

for _, v in pairs(workspace:GetDescendants()) do
	if v:IsA("BasePart") then
		if v.CanCollide == false and v.Transparency == 1 then
			table.insert(IgnoredItems,v)
		elseif game.Players:GetPlayerFromCharacter(v.Parent) then
			table.insert(IgnoredItems,v)
		elseif v.Parent.Name == "LightningDebris" then
			table.insert(IgnoredItems,v)
		end
	end
end

local part, position = game.Workspace:FindPartOnRayWithIgnoreList(NewRay,IgnoredItems)
local final = position.Y -400
rock.Position = Vector3.new(x,position.Y,z)
local TopPart = Instance.new("Part",workspace)
TopPart.Transparency = 1
TopPart.Anchored = true
TopPart.CanCollide = false
TopPart.Size = Vector3.new(0.1,0.1,0.1)
TopPart.Position = rock.Position + Vector3.new(0,abovegounrd2studs,0)
rock.Name = "LightningBase"
local r = 30
local x,z = rock.Position.X,rock.Position.Z
x,z = math.random(x - r,x + r),math.random(z - r,z + r)
TopPart.Position = Vector3.new(x,TopPart.Position.Y,z)
local topposition = TopPart.Position
local bottomposition = rock.Position
local LightningSound = game.ServerStorage.ServerAudio.Effects.Lightning:Clone()
LightningSound.Parent = rock
LightningSound:Play()
spawn(function()
	task.wait(3)
	local PercentTransition = 10
	local MaxVolume = LightningSound.Volume
	for i = 1,10 do
		task.wait(0.2)
		LightningSound.Volume = LightningSound.Volume - MaxVolume / PercentTransition
	end
end)
TopPart:Destroy()

return topposition,bottomposition

end

Lightning.Bolt = function(from,too,firepos)
task.wait(0.3)
for i = 1,3 do
task.wait()
ShootElectrode(from,too)
end
local Fire = game.ServerStorage.ServerAssets.FireBase:Clone()
Fire.Parent = workspace
Fire.Position = too
Fire.Sound:Play()

task.wait(10)
pcall(function()
	game.Workspace:FindFirstChild("LightningBase"):Destroy()
end)

end

Lightning.Strike = function(firepos)
local StartPosition,EndPosition = LightningStrike(workspace.Spawner)
Lightning.Bolt(StartPosition,EndPosition)
end

Lightning.StikePosition = function(refpart,firepos)
local StartPosition,EndPosition = LightningStrike(refpart)
Lightning.Bolt(StartPosition,EndPosition,firepos)
end

return Lightning

Well it tells it to have a lightning strike every so often if it’s raining, but nothing about Thunder.

i meant thunderstorm yk lightning weather

will something like this work?

i also managed to make the lightning parts invisible and mute the sound but that was only possible with a script inside of serverscriptservice so that wont work because im using “math.random” in my rain cycle local script which is located in starterplayerscripts

You can just exit the function in the ModuleScript when it is not raining - and run another one.

Won’t bother to read that atrocious code.

but im using math.random so i cant tell when it is gonna rain or not

i got the lightning script from here:

im just trying to make it work with my rain cycle script

here is my rain cycle (it is also with snow cycle)
RainAndSnowCycle.rbxm (17.8 KB)

i arleady made a topic on this:

i also showed my attempt there, but lets not go off topic and just plz tell me how to disable module script using local script

@KingxSlavy already answered for you: RemoteEvent.

Again, disabling a script while it’s running won’t halt execution.

To do this, exit the thunder function in the ModuleScript when the weather is not day. For that:

if weather == day then
	Lightning.StopThunder()
end

And have said function do the rest.

Ah, said function does not exist. Code it yourself.
Nor was the example intended to be functional. I’m on mobile, can’t do much. However, we’re trying to help, if you don’t listen, we can’t do anything.

but i didnt mean to use the rain script that the lightning script came with i meant to use mine

yo wait i came up with a smart idea

Did you not remove the old rain script then? Also, what’s your rain script?

This time please codeblock it.

-- this is a codeblock.

Screenshot_2022-12-29-14-21-00-105_com.android.chrome

what if i edit the time when the rain starts (yk the time in lighting) and stop the module script if that specific time has come

is that possible? cus i dont want to waste my time doing that if it dosent work ㅤ ㅤ ㅤ ㅤ ㅤ ㅤ ㅤ ㅤ ㅤ ㅤ ㅤ ㅤ ㅤ ㅤ ㅤ ㅤ

Do I have to tell you again that the module won’t stop running even when you disable it?