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

How can a script check if a value is within a certain range of numbers?

Asked by 5 years ago

How can I check to see if the currentDroplet value is within a certain range of numbers? For ex. 6-11 or 64-78.

~~~~~~~~~~~~~~~~~currentDroplet = 0

for i = 1, 100, 1 do --Creates the droplet droplet = Instance.new("Part")

01--Sets the droplet's properties
02droplet.BrickColor = BrickColor.new("Toothpaste") or BrickColor.new("Teal")
03droplet.Position = Vector3.new(math.random(13,30),math.random(97,108),math.random(33,40))
04droplet.Anchored = true
05droplet.Size = Vector3.new(1, 2, 1)
06droplet.Transparency = 0.8
07currentDroplet = currentDroplet + 1
08droplet.Name = "Droplet"..currentDroplet
09wait(1)
10droplet.Anchored = false
11 
12if currentDroplet <=50 then
13    droplet.Parent = script.Parent["Droplets1-50"]
14--right here I want to check if the currentDroplet value is equal to any number inbetween 51 and 100
15 
16 
17end

end

~~~~~~~~~~~~~~~~~

0
The end outside of the code block is meant to be inside it, sorry soccerstardance251 29 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago
1if currentDroplet > 50 and currentDroplet <= 100 then

Try This

0
I got an error: Workspace.RainCloud.RainGenerator:21: Expected identifier when parsing expression, got '<=' soccerstardance251 29 — 5y
0
I edited the answer. Try that and see if it works bittersweetfate 142 — 5y
0
Thank you soccerstardance251 29 — 5y
Ad

Answer this question