I have that script, but i dont know how and where place and. I want that, If Light.Value ==1 AND if V (IntValue) == 1 then script.Parent.Base.PointLight2.Range = 18 script.Parent.Humanoid.WalkSpeed = 30
01 | local Player = game:GetService( "Players" ).LocalPlayer |
02 | local stats = Player:WaitForChild( "leaderstats" ) |
03 | local Light = Player.leaderstats.Light |
04 |
05 | while true do |
06 | if script.Parent.V.Value = = 1 |
07 | and |
08 | if Light.Value = = 1 then |
09 |
10 | script.Parent.Base.PointLight 2. Range = 18 |
11 | script.Parent.Humanoid.WalkSpeed = 30 |
12 |
13 | end |
14 |
15 | end |
You can use and
in a singular if statement like so...
1 | if condition and condition 2 then |
2 | ... |
3 | end |
In your case...
1 | if script.Parent.V.Value = = 1 and Light.Value = = 1 then |
2 | script.Parent.Base.PointLight 2. Range = 18 |
3 | script.Parent.Humanoid.WalkSpeed = 30 |
4 | end |
You place the "and" between 2 arguments in an if statement if you want the code inside the statement to execute if BOTH arguments return true.
Let's say for example:
01 | a = 2 |
02 | b = 3 |
03 |
04 | if a = = 2 and b = = 3 then |
05 | *code* --executes because both arguments are true |
06 | end |
07 |
08 | if a = = 1 and b = = 3 then |
09 | *code* --doesn't execute because 1 argument isn't true (even if 1 is) |
10 | end |
If you're familiar with C++, this would translate to "&&"
If you would want the if statement to execute even if 1 argument isn't true you can use "or":
01 | a = 2 |
02 | b = 3 |
03 |
04 | if a = = 2 or b = = 3 then |
05 | *code* --executes because both arguments are true |
06 | end |
07 |
08 | if a = = 1 or b = = 3 then |
09 | *code* --executes because 1 argument is true (even if 1 isn't) |
10 | end |
1 | if a = = 0 and b = = 1 then |
2 | *code* --doesn't execute because neither argument is true |
3 | end |