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

Vector3 and Number Randomly?

Asked by 1 year ago

Basically, my friend got an error called "attempt to perform arithmetic (sub) on vector3 and number." The line of code that caused this is in this discord attachment link. https://cdn.discordapp.com/attachments/993644972224036965/1046595153818832926/image.png

the vector3 and number error message is in this discord attachment link. https://cdn.discordapp.com/attachments/993644972224036965/1046594002167804015/image.png he doesnt know how to fix this and a scripter isnt responding to him either so i made this question on how to fix this. hope maybe someone can help me. if its not understandable enough then i dont know??

0
The link does not work NykoVania 231 — 1y
0
ofc it doesn't work because you're not in their discord server/conversation T3_MasterGamer 2189 — 1y
0
Sorry for not doing the images thing instead. i dont kow how to put them for now. RENAN8282828282 0 — 1y

2 answers

Log in to vote
0
Answered by 1 year ago

I can’t view the code, if you could post it here I could be more of a help.

But from what I can tell you’re likely trying to subtract a number from a Vector3 value. Try removing the subtraction sign and see if it goes away. If it does then subtract the value some other way.

0
I would put the images, but i dont know how yet since i only joined yesterday to help my friend on this specific one line of code. RENAN8282828282 0 — 1y
Ad
Log in to vote
0
Answered by 1 year ago

You are trying to subtract a Number from a Vector3 value. "monster.Position" is a vector3 value and cannot be in the same arithmetic as a different type of value (number)

Try: ~~~~~~~~~~~~~~~~~ if monster.Position.****Magnitude**** - handle.Position.Magnitude < 5 then ~~~~~~~~~~~~~~~~~

Adding magnitude will convert the vector3 into a single number.

0
idk why the formatting didnt work, heres the block of code: if monster.Position.Magnitude - handle.Position.Magnitude < 5 then candykid44 40 — 1y

Answer this question