Answered by
6 years ago Edited 6 years ago
If this is your code, and you want to fix this, you can detect if a number is between two other numbers like this:
1 | local value = game:GetService( "Players" ).LocalPlayer.Character.HumanoidRootPart.Position.Y |
2 | if value > 50 and value < 100 then |
Explanation: In programming languages, there are relational operators. Two examples for that are >
and <
. This two are used between two numbers, or two other values arithmetic can be done on. Let's say we got this statement: x > y
this means: x is bigger than y. < it's reverse, x < y
x less than y. We need (for this script) another operator: and
. if statement1 and statement2 then
the code in that IF statement will run if statement1
and statement2
are both true. Example: if 5 == 5 and 6 == 6 then
code in the IF stat. will run. Example2: if 5 == 5 and 6 == 7 then
code in the IF stat. will NOT run