How do I check if the y value in a Vector3 is a specific number?

Hello, I want to check if one part of a Vector3 is a specific number and disregard the others. I want to make a if true do condition script thingy but want it to equal true if the vector3 value’s middle number is the same, for example true would be outputted with any of the following

(1, 0, 3)
(1000, 0, 1000)
(777, 0 2121212121)

How do i do this?

If you’re wanting to check a certain Vector’s axis, you can do so by referencing one of the 3 axis properties

local vector = Vector3.new(6,0,4) --Example

if vector.Y == 0 then
   --Do stuff
end
2 Likes

thank, you that is exactly what i was looking for :smiley:

1 Like

Anytime! If you have anymore issues don’t be afraid to make another post!

Also don’t forget to makr it as the solution if it has helped you so others will know this is fixed!

1 Like