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

Error for Ray.new?

So, I was trying to make Ray.new for a gun I'm trying to make but it didn't work I don't know why, I did:

		local Ray = Ray.new(script.Parent.BulletSpawn, (Mouse.Hit.p - script.Parent.BulletSpawn.CFrame.p).unit * 300)

The output has an error I don't understand.. It said: "19:13:50.474 - Workspace.Player.Pistol.LocalScript:7: bad argument #1 to 'new' (Vector3 expected, got Object)" It says I needed a Vector3..

1 answer

✓ Accepted answer

You put in an object for the first argument ( script.Parent.BulletSpawn ), but the error says it needs a Vector3. Therefore you must give it a Vector3.

local Ray = Ray.new(script.Parent.BulletSpawn.Position, (Mouse.Hit.p - script.Parent.BulletSpawn.CFrame.p).unit * 300)

1 comment

0

Oh, I didn't notice that... I feel dumb now..

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