I have this small portion of my code:
bullet
is a part that is inserted in the workspace.
local BV = Instance.new("BodyVelocity",bullet) BV.MaxForce = Vector3.new(math.huge,math.huge,math.huge) --BV.Velocity = script.Parent.Handle.CFrame.lookVector*100 BV.Velocity = mouse.Hit
Everytime I run this code there's an error saying:
bad argument #2 to '?' (Vector3 expected, got number)
How do I get the vector 3 of a mouse?
Thanks!
Position isn't a member of Mouse But there's another thing called p which is a property of hit which is also a property of the mouse Knowing that We can get the position of the mouse in a Vector3 easily
local plr = game.Players.LocalPlayer local mouse = plr:GetMouse() while wait() do print(mouse.hit.p) --This will print the Vector3 position of the mouse end
--local part = game.Workspace:FindFirstChild("Part") local player = game.Players.LocalPlayer local mouse = player:GetMouse() print(mouse.CFrame) print(mouse.Position) --part.CFrame = mouse.CFrame