Raindrop didnt move at all? (30)
It did move. but not correctly like a rain drop
Can you record it? (30charracters)
Yes! Sure, I will do it. The video quality won’t be that good.
robloxapp-20200817-1212549.wmv (497.6 KB)
See it yourself, the rain part is big, but the raindrops aren’t doing well as intended.
Can u show me what u got now? (I mean code)
Sure! Here you go;
local rainPart = workspace.RainPart
local x = rainPart.Size.X / 2
local z = rainPart.Size.Z / 2
while true do
for i = 1, 10 do
local prt = Instance.new("Part", workspace)
prt.Anchored = false
prt.CanCollide = true
prt.Name = "Drop"
prt.Material = "Neon"
prt.BrickColor = BrickColor.Blue()
prt.Size = Vector3.new(0.39, 1.2, 0.3)
local rx = math.random(-x , x)
local rz = math.random(-z , z)
prt.CFrame = rainPart.CFrame * CFrame.new(rx, 0, rz)
wait(0.5)
end
wait(0.5)
Thats weird, seems like rx or rz is always the same, can u print them?
Ye, here;
1st - Z was 0
2nd - X was 90
I would actually use a particle emitter rather making a bunch of parts. However if you want to keep going down this paradigm I would just say get the spawners x and y size and set that as the limit when doing a non pure function such as math.random()
You know what I hate about particle emitter, the particle goes inside the buildings which isn’t that great.
Well you can make spawners for specific buildings and adjust the life time of the particle to match the time when it touches the building. Much more efficient than creating 1k parts
I don’t understand what you mean?
You can adjust the life time of the particles so that they respawn after they reach a certain height
Great idea. But I don’t think other games use Particle Emitter for rain? do they?
Why would you care, just do it?
Just wanna ask. Thanks for all your help, I really appreciate it.
I created a rain system which consists of following the player it does not cover an entire area but I find the same problem as you it goes through buildings (because I use ParticleEmitter)…
Would you have a solution to this ?
its why you should use parts. What i do is that i use raycasting and tweening to make the raindrops fall from the sky. Raycasting is to shoot down rays to the surface, possibly like 5000 studs downwards from the main rain part, this allows me to get hit positions so that i can tween it to surfaces. This also prevents the rain drops from going through roofs and objects.
However, there are a few things to consider:
-
Part Capping: If you don’t implement a part capping system (limiting the amount of parts spawn), over 1000+ parts will be used to simulate the rain opposed to limiting it to 150-300 parts (which is fine). If you want to prevent lag at ALL COSTS, part capping is something you should do.
-
Rain Range: The bigger the range, the more seperate and less frequent the raindrops become (this is due to part cap, increasing the cap will solve this issue but at the cost of more parts spawning, best way to do it is to simply reduce the range).
-
Useless Parts: Always make sure that parts that don’t have raycast results don’t stay hanging, not only will it slow down the game over time, It will also look weird because they are always stuck on the cloud. The best way to do this is to make it destroy parts (or simply use debris but its not recommended) when the part doesnt recieve results.
Another way with dealing with this is simply using a custom roblox particle system that has collision (Like this) and some scripting.
Or even better, use raycasting and the normal roblox particle system to make it so that if there’s anything above the player… the particle emitter stops emitting rain particles.
Part Caching is also an option, but in my experience, its a bit problematic at times.
All in all, These are my suggestions for a rain system. All you need to think about is the coding complexity and the performance impact. If the method has too much impact on performance (if you tested) or is too complex to code, then go for something else.