makeitxx
(CrocoRoco)
September 20, 2024, 3:50pm
1
so for some reason i keep getting an error when im trying to compare numbers added to eachother, to see if they are bigger than a given range, but it keeps saying its an instance
and yes i know it doesnt have to be in parentheses, but even when i tried it without them, it did the exact same thing, is this a bug, or am i just confused on something
3 Likes
GE_0E
(GE_0E)
September 20, 2024, 3:55pm
2
print it before doing the if statment and see if its a number or an instance
range is an instance make sure that ur passing the correct argument
Convert the values to number
tonumber(value.z)
tonumber(value.x)
GE_0E
(GE_0E)
September 20, 2024, 4:03pm
4
you cannot convert instances to numbers that only work with strings
if you check the script, it is not an instance, it is a value of a Vector3 which is a number
1 Like
GE_0E
(GE_0E)
September 20, 2024, 4:13pm
6
then the error msg was going to be smt like this
1 Like
He is getting Z axis and X axis of them, not the exact whole vector3.
1 Like
GE_0E
(GE_0E)
September 20, 2024, 4:17pm
8
yes but if he got the X or Z value then they should be numbers
the error msg says that he is comparing an instance to a number so calling tonumber() on an instance would do nothing
If it says it is an instance, then he should convert it to number.
GE_0E
(GE_0E)
September 20, 2024, 4:19pm
10
converting an instance to a number with tonumber() will return nil and will give an error because you cant compare a number with nil
GE_0E
(GE_0E)
September 20, 2024, 4:23pm
12
i readed it already before
i still don’t get why to use tonumber() on an instance/vector3 can you show an example?
the error that he is getting is because range is an instance calling tonumber() on it would return nil which will result in an error
range is a number as you see in the script and Z and X are numbers of Vector3 too, i do not know how do you think they are instances.
if the script is thinking it is a instance then he got to convert that number to an actual number using tonumber()
GE_0E
(GE_0E)
September 20, 2024, 4:29pm
14
that error means that range is an instance and (Xvel + Zvel) are numbers already
sonic_848
(killer)
September 20, 2024, 4:29pm
15
range IS an instance according to the error. He probably accidentally passed an instance instead of a number into the function. @GE_0E is right.
I’m trying to fix the issue by the function I am seeing right now, you might be right, but my point is not wrong too.
GE_0E
(GE_0E)
September 20, 2024, 4:31pm
17
calling tonumber() on a vector3 would still do nothing
print(tonumber(Vector3.new(5,5,5)))
sonic_848
(killer)
September 20, 2024, 4:32pm
18
I’m not lying this is happening 100% because the OP passed an instance instead of a number. There is nothing wrong with the function.
Man, he is using the Z and X components not the whole Vector3…
1 Like
That’s mean that this post is missing something.