-
What do you want to achieve? Keep it simple and clear!
I’m trying to script particle life.
But the problem is that it’s giving me nan in bodyvelocity and I don’t know why -
What is the issue? Include screenshots / videos if possible!
And when i was testing my script this happend
no matter what equation i’ll write the result is same (nan)
f means force
PS i tried this equation but it didin’t give me satysfying results
vel2.Velocity = (CFrame.lookAt(prt2.Position,prt.Position).LookVector * f12) / magnitude
What is magnitude
?
You can also use the lua debugger to step through your code line-by-line and watch variables as they change to see if they’re what you expect.
magnitude is distnace beetwen prt and prt2
(prt.Position - prt2.Position).Magnitude
It could be possible that you are checking the same part against itself, which would make the magnitude zero. Dividing by zero might be what’s causing the issue.
I don’t think so
Beacuse im adding to velocity so even if it’s zero velocity will be the same
Dividing something by zero in lua gives you inf
, but dividing zero by zero gives you nan
. Check the position values you are using to construct the CFrame as well, if they are too close to each other they might be causing it too.
saddly i can’t check that out bc whenever i’m trying to get to roblox studio i get this
Also explorer is empty and all I can see is my script.
I don’t think we can help you much more unless if we see some more of the code that’s causing this issue. Seems like something is going wrong beyond these few lines?