Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make a health draining rain?

Asked by 10 years ago

I'm about to make a game that contains a radioactive rain but there're two little something.

  1. How to make the rain (I simulate the rain using the fog in lighting tab) appears randomly.

  2. How can I make it drain people's health IF they're out in the open (Not under a shelter)

Sorry for my grammars if there're any error.

2 answers

Log in to vote
0
Answered by 10 years ago

1) To make the rain you could use GUIs. (An example of this can be seen here.)

2) To find out if they are not under shelter, you could cast a ray above them and check if any parts are returned, if not they are in the open. A simple loop should suffice for the health drain.

Ad
Log in to vote
0
Answered by 10 years ago

1: Use math.random() to randomise the X and Z axis of the rain. Example:

Rain.CFrame = CFrame.new(math.random(100, -100), 0, math.random(100, -100))

2: Make it so that the rain gets removed when it touches an object using the Touched event, so that it won't hit the players once they are underneath the shelter. Then, if it does touch them, just make their health lower. Example:

Rain.Touched:connect(function(Hit)
    local Humanoid = Hit.Parent:findFirstChild("Humanoid")
    if Humanoid then
        Humanoid.Health = Humanoid.Health - 5
    end
    Rain:Destroy()
end)
0
Uh... I'm new to scripting. harry233 0 — 10y
0
And also, how can I do it while using "Make it rain!" plugin? http://www.roblox.com/Make-it-rain-item?id=143694347 harry233 0 — 10y

Answer this question