Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Mouse's position is considered a number value?

the error is: bad argument #2, to ? (Vector3 expected, got number)

local tgt1 = m.Hit.p
v.velocity = tgt1*100

Other things you should know before you call me out on it: 1: I left out most of the script on purpose, and left these two lines as they are linked as a problem. And I know that everything is defined. v is a bodyvelocity object m is the mouse of the player

1 comment

0

You are certain you cannot use this line: v.velocity = Vector3.new() without the script erroring?

2 answers

I think it is because Hit is nil for a brief moment at some point. This can happen if the player looks into the sky or anywhere there are no parts. To fix this, try this:

local target = m.Hit
if target ~= nil then
	local tgt1 = target.p
	v.velocity = tgt1*100
end

Instead try Vector3.new(100,100,100). Reading from what the output said, 100 is a bad argument so try using a Vector3.

3 comments

0

Same error. .3.

0

Darn. Hmm There just isn't enough information for me.

0

He's actually multiplying a Vector3 (m.Hit.p) by 100, which should result in a Vector3.

This discussion is preserved as it was. New answers, comments, and votes are closed.