Vector3 expected got number, but the given value is a Vector3?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to get the parts at a certain positions using workspace:GetPartBoundsInBox()
  2. What is the issue? Include screenshots / videos if possible!
    The issue is that the script thinks that the given value is a number and not a Vector3

    And here is the code:
local hitbox = workspace:GetPartBoundsInBox(hrp.CFrame + hrp.ExtentsCFrame.Z * 2, Vector3.new(4, 3, 4))
  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I searched for like 15 mins and i couldn’t find any information about my problem and how to fix it

This was done on the Server

I’m not sure if you can do that equation, I never used ExtentsCFrame, but by the “Z” I would consider it’s returning a number, so it’s adding a number value inside of a CFrame value

Thats not the part that is causing the error.
in the ouput it says the second argument is a number and not a Vector3

Try replacing this with hrp.CFrame * hrp.ExtentsCFrame.Z * 2. As far as i know, you can’t simply add two cframes together, You have to multiply them.


The error is about the first argument I’m pretty sure.
(Did something similar in studio and got this in the output)

I’ll test that rq. charsssssssssss

1 Like

Yup that was it :skull:

I thought workspace:GetPartBoundsInBox() Was erroring because it said the second argument was erroring (Also because the second argument expected a Vector3)
I can’t believe i’ve been scripting for 2 whole years and still overlook mistakes like these lol

Thanks for the help though.

1 Like

Yeah I wish the compiler would specify the error a bit more, I’d probably think I was going insane if I got this error.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.