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 4 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")

--Sets the droplet's properties
droplet.BrickColor = BrickColor.new("Toothpaste") or BrickColor.new("Teal")
droplet.Position = Vector3.new(math.random(13,30),math.random(97,108),math.random(33,40))
droplet.Anchored = true
droplet.Size = Vector3.new(1, 2, 1)
droplet.Transparency = 0.8
currentDroplet = currentDroplet + 1
droplet.Name = "Droplet"..currentDroplet
wait(1)
droplet.Anchored = false

if currentDroplet <=50 then
    droplet.Parent = script.Parent["Droplets1-50"]
--right here I want to check if the currentDroplet value is equal to any number inbetween 51 and 100


end

end

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

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

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago
if 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 — 4y
0
I edited the answer. Try that and see if it works bittersweetfate 142 — 4y
0
Thank you soccerstardance251 29 — 4y
Ad

Answer this question