I’ve been testing out magnitude, to check if the mouse.target is like 1 magnitude and it will count it as a hit instantly instead of spawning a projectile, but here is the module:
function module.cast(gun, endpos, velocity)
local spawnpos = gun.Handle
local projectile = ReplicatedStorage.projectile.shuriken:Clone()
projectile.Parent = workspace
projectile.CFrame = CFrame.new(spawnpos.Position, endpos)
local Loop
Loop = RunService.RenderStepped:Connect(function(dt)
projectile.CFrame *= CFrame.new(0, 0, -velocity * (dt * 60))
if (projectile.Position - spawnpos.Position).Magnitude > 5000 then
projectile:Destroy()
Loop:Disconnect()
end
end)
end
It’s probably because the function you showed is just using physics to decide what to do next. So when it hits the player’s head it just follows the rules of physics and bounces off. What is your desired result? Do you want it to destroy itself when it hits the head?
No as I have previously made fps frameworks and know how to make a working one but I always had this problem like if there was 2 people having a close fight their bullets would just bounce off and they have to step back to actually damage each other, but I think this magnitude thing might solve it.
Irs because however you’re finding the direction, you’re looking from somewhere other than the exact center of the camera. Since they start aiming up when you get close, you know that point is lower than the camera.