I know cloning the bullet and stuff like that and GetMuse() but I'm not sure how to use mouse very well.Can I get an explanation or can you refer me somewhere
✓ ANSWER ACCEPTED
How would you make a bullet go to the direction of the mouse?
1 answer
✓ Accepted answer
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local function computeDirection(vec)
local lenSquared = vec.magnitude * vec.magnitude
local invSqrt = 1 / math.sqrt(lenSquared)
return Vector3.new(vec.x * invSqrt, vec.y * invSqrt, vec.z * invSqrt).unit
end
mouse.Button1Down:connect(function()
if not plr.Character then return end
local dir = computeDirection(mouse.Hit.p - plr.Character.Torso.Position)
--'dir' is your direction. Continue from here.
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Thank you