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

How do I use an if statement with a vector3 value and a bool?

Asked by 5 years ago
Edited 5 years ago
print(camera:WorldToViewportPoint(Torso.Position))
if camera:WorldToViewportPoint(Torso.Position) then
end

When I print it, it gives me a Vector3 value and a Bool value. How do I check the bool value for the if statement? If I do == true then it doesn't work because it is equal to a vector3 and bool.

1 answer

Log in to vote
0
Answered by
INOOBE_YT 387 Moderation Voter
5 years ago

When a function returns multiple values, you'll have to make a variable for each value.

local FirstVal, SecondVal = camera:WorldToViewportPoint(Torso.Position)

Now, both values are individual and can be used in the if statement. if you want to use the vector3 in the if statement, that will be the first value and the bool value will be the second value.

0
Thank you goldstorm950 65 — 5y
Ad

Answer this question