How to make precipitation

From Goodblox Wiki
Revision as of 17:26, 22 June 2020 by Pizzaboxer (talk | contribs) (Created page with "<b>NOTE: Having cloud meshes over your place makes for a great scene. If you don't have storm clouds, but you want them, search "cloud" or "storm clouds" in Toolbox...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

NOTE: Having cloud meshes over your place makes for a great scene. If you don't have storm clouds, but you want them, search "cloud" or "storm clouds" in free models. It makes the entire effect a lot better.

Building The Droplet

So first, we need to create the droplet. On the toolbar click Insert> Object and find and double click on "Part". There will now be a brick in your place. Now you need to make the brick look like a rain droplet. Follow these guidelines to do so:

  • In the properties of the brick that you want to be a droplet, set the size to 1,1,1.
  • Set the shape to ball.
  • Set the color to any shade of blue.
  • Set the transparency between 0.1 and 0.4.
  • Set the reflectance to 0.1.
  • Make sure you uncheck the CanCollide box, unless you want the droplets to stay on the ground.

So now you have your droplet. Name it "Drop" (without quotes), drag it to a spot on the map where people might not find it, and anchor it.

The Script

Now comes the important part; the script.

We want it to loop. Insert a script into the workspace and add the following. The comments within the code give descriptions of what each line does.

while true do -- a continuous loop.

Now we need to put how long it will wait before making another.

wait(0.1) -- waits one tenth of a second before continuing.

The next part copies the rain you previously created.

game.Workspace.Drop:clone() -- makes a copy of the droplet.

Here's our script so far:

while true do
wait(0.1)
droplet = game.Workspace.Drop:clone()

Now we have to define the droplet's parent and position, and un-anchor it.

droplet.Parent = game.Workspace -- makes droplet appear in the game 
droplet.Anchored = false -- unanchors the droplet
droplet.Position = Vector3.new(math.random(-512,512),100,math.random(-512,512)) -- creates droplet and places it randomly in the sky.
end --ends the loop.

Now, lets see what we have.

while true do
wait(0.1)
droplet = game.Workspace.Drop:clone()
droplet.Parent = game.Workspace
droplet.Anchored = false
droplet.Position = Vector3.new(math.random(-512,512),100,math.random(-512,512))
end

The Finished script

while true do
wait(0.1)
droplet = game.Workspace.Drop:clone()
droplet.Parent = game.Workspace
droplet.Anchored = false
droplet.Position = Vector3.new(math.random(-512,512),100,math.random(-512,512))
end

Just put that code into a script in workspace, and voilà- you should have rain falling from the sky when you go to your place! Feel free to edit the script as you please.

A Little Extra Fun

If you're looking for some fun, put the code below into a script inside the Drop brick.

function onTouch(hit)
local p = Instance.new("Explosion")
p.Parent = game.Workspace
p.Position = script.Parent.Position
p.BlastRadius = 5
p.BlastPressure = 1000
script.Parent:remove()
wait(0.5)
p:remove()
end

script.Parent.Touched:connect(onTouch)

That will make bombs fall from the sky!

See Also