The if and elseif statements work when i tweak my variables but the final else statement does not work. Am i doing something wrong?
num = 1 num2 = 3 function ifStatement() if num > num2 then script.Parent.Size = Vector3.new(2,2,2) elseif num == num2 then script.Parent.Transparency = 0.3 else script.Parent.Velocity = Vector3.new(1,0,1) end end ifStatement()
The final 'else' statement does work. IDK what the "Velocity" part of your script's parent (most probably a BasePart) does. You can add a print()
function after
script.Parent.Velocity = Vector3.new(1, 0, 1)
Like this:
script.Parent.Velocity = Vector3.new(1, 0, 1) print(script.Parent.Velocity)
It is going to print out the Velocity which, you guessed it, is 1, 0, 1
. According to my knowledge, changing the velocity of a BasePart
does nothing unless some special requirements are met. It just sets the Velocity, then waits for the requirement, most probably an instance, like BodyVelocity
. Again, I am not sure what it does, so please correct me if you know.
Anyways, I hope my answer helped. Have a great day ahead!