Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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.

1 comment

0

Thank you

This discussion is preserved as it was. New answers, comments, and votes are closed.