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

mouse.Hit.LookVector is inaccurate, any help?

Asked by 4 years ago

Hello all.

I have been trying to make a aimable throwable knife and this is all I got.

local new = game.ServerStorage.Knife:Clone()
new.Parent = plr.Character
new.Holder.CFrame = torso.CFrame
local veil = Instance.new("BodyVelocity", new.Holder)
veil.P = math.huge
veil.Velocity = mouse.hit.LookVector * 50

However when I test it, it seems to be inaccurate. Any solution?

1 answer

Log in to vote
0
Answered by 4 years ago
local knife = script.parent
local Handle = knife.Handle
knife.CFrame = CFrame.new(Handle.Position ,mouse.hit.p)local veil = Instance.new("BodyVelocity", new.Holder)
veil.P = math.huge
veil.Velocity = knife.CFrame.LookVector * 50
0
it should work but i didn't check it asdfghjk9019 225 — 4y
0
Thank you asd, It worked but it didn't rotate to the correct way. MineBlow111 39 — 4y
0
@MineBlow111 if it doesn't rotate properly just re rotate it xd BlackOrange3343 2676 — 4y
Ad

Answer this question