Rain script is not working for the client as intended

  1. basically it’s suppose work how it does already right now it’s just a rain script simple as that Rain and Splashes effects, nothing is technically wrong just won’t work as intended.

  2. some reason the script works completely fine except when there is another player who joins the game some reason “Drops” from the RainParticles model is not being destroyed when one of the local players are under cover, it works for everything except for the Drops and it only happens if theres another player in the game

  3. i tried everything i can think of to changing how it removes it and how it places the model to the Workspace, since workspace is server then i tried changing it to try making it for the client instead but idk it wouldn’t let me i can’t do it lol even tried to change the under cover functionality still won’t work.

-note- yea this was a free model but i was trying to edit it and fix it up make it work better in general and i got it good rn but its just 1 issue with it i can’t figure out

local particles = script:WaitForChild("RainParticles")

local underCover = false

local camera = workspace.CurrentCamera

local tweenService = game:GetService("TweenService")

local balls = {}

local lastBall = tick()



local function RenderStepHandler()
	local player = game.Players.LocalPlayer
	if not underCover then

		if workspace:FindFirstChild("RainParticles") and workspace.RainParticles ~= particles then
			workspace.RainParticles:Destroy()
		end

		particles.Parent = workspace

		if tick() - lastBall >= Random.new():NextNumber(0.3, 0.7) then
			local ball = Instance.new("Part")

			local specialMesh = Instance.new("SpecialMesh", ball)
			specialMesh.MeshType = Enum.MeshType.Sphere

			ball.Material = Enum.Material.Glass
			ball.Transparency = 0.5
			ball.CastShadow = false
			ball.Anchored = true
			ball.CanCollide = false

			local size = Random.new():NextNumber(0.1, 1.3)
			ball.Size = Vector3.new(size, size, size)

			local x = Random.new():NextNumber(-40/2, 40/2)
			local y = Random.new():NextNumber(-15/2, 15/2)

			local xOffset = camera.CFrame.RightVector * x
			local yOffset = camera.CFrame.UpVector * y

			local zOffset = camera.CFrame.LookVector * 10

			local yTweenValue = Instance.new("NumberValue")
			yTweenValue.Value = 0

			table.insert(balls, {ball, x, y, yTweenValue})

			ball.Parent = workspace

			spawn(function()

				wait(wait(Random.new():NextNumber(0, 1)))

				local tweenInfo = TweenInfo.new(Random.new():NextNumber(1, 3), Enum.EasingStyle.Quint, Enum.EasingDirection.In)

				local transparencyTween = tweenService:Create(ball, tweenInfo, {Transparency = 1})
				transparencyTween:Play()

				local dropTween = tweenService:Create(yTweenValue, tweenInfo, {Value = Random.new():NextNumber(1, 5)})
				dropTween:Play()

				transparencyTween.Completed:Wait()
				ball:Destroy()
			end)

			lastBall = tick()
		end

	else

		particles.Parent = game.ReplicatedStorage
	end

	
		local rayParams = RaycastParams.new()
		rayParams.FilterDescendantsInstances = {script.Parent, particles}

		local head = player.Character:WaitForChild("Head")

		if head then
			local ray = workspace:Raycast(head.Position, head.Position + Vector3.new(0, 100000000, 0), rayParams)

			if ray and ray.Instance and ray.Instance.Transparency < 1 then
				underCover = true
			else
				underCover = false
			end
		end
	







	for i, ballInfo in pairs(balls) do

		local xOffset = camera.CFrame.RightVector * ballInfo[2]
		local yOffset = camera.CFrame.UpVector * ballInfo[3]

		local zOffset = camera.CFrame.LookVector * 10

		local dropOffset = -camera.CFrame.UpVector * ballInfo[4].Value

		ballInfo[1].CFrame = camera.CFrame + xOffset + zOffset + yOffset + dropOffset

		local size = ballInfo[1].Size

		ballInfo[1].Size = Vector3.new(size.X, size.Y + ballInfo[4].Value/Random.new():NextNumber(70, 90), size.Z)
	end

end

RenderStepConnection = game:GetService("RunService").RenderStepped:Connect(RenderStepHandler)

	
	
RenderStepConnection:Disconnect()
task.wait(0.01)
RenderStepConnection = game:GetService("RunService").RenderStepped:Connect(RenderStepHandler)
2 Likes

Maybe instead of trying to code rain or trying to modify free models, try this plugin.

This should save you tons of time, unless you wanna avoid using plugins, then in that case I cannot do anything helpful

the plugin is not good it does not have a cover mechanic. it rains through roofs and everything i build that’s not worth using. it says it has collisions functionality but it does not work at all. rain still goes through everything no matter what.

Strange, never experienced rain through solid parts when using it myself, not sure what could be causing that.

nothing in my game causes it so nothing in the game is even affecting it. the plugin just sucks on my end lol i literally just tried using it just now. it did not work, i do wish it did i do like the effects

I can’t seem to replicate this;


Perhaps it’s something to do with transaparency or cancollide of your parts?
image

no i found out why it was happening just now though lol literally, but yea the problem is cause the ceiling/roofs were too thin for it, someone even in the post of the creator of the plugin in dev forums even mentions this being an issue so i checked and yea it’s from that i just now got it by doing what the person suggested to fix it which is place a thick brick over what i want to consider a cover

1 Like

Mark your post as solved then, glad I could help :v:

well no my script is not solved so no. i didn’t even wanna use the plugin in the first place lol and i used it before using what i used before is not a fix, specially when i have to add a thick invisible brick over my builds and waste time doing so when i could already have a working rain system which is the script i have there is one issue with it. you did not help stop

what’s with the attitude?

I gave you a workaround, you don’t have to put massive invisible bricks over any thin part, just make the part slightly bigger.

I don’t get the problem

not even true lol, and not an attitude i’m telling you and explaining to you how you did not help. i have to edit my entire builds by detail it’s not as simple as making them slightly bigger. this isn’t a flat house i’m working on.

I’ve literally checked different part heights:


1 stud doesn’t phase through
0.75 doesn’t phase through
0.5 doesn’t phase through
0.25 doesn’t phase through


What kind of thickness are your parts if rain passes through them?

it didn’t matter afterwards it still passed through regardless after trying again. that plugin just isn’t good honestly lol think it’s out of date anyways. but no matter what the transparency is or thick or thin it doesn’t matter anymore so i’m just done with it. worked 1 time when making a thick part over what i want as cover but after trying it again it stopped so i’m done with it. plugin is obviously broken and out of date anyways

can anyone help? i still got the issue