Using Raycast to fire bullets?
Hello, I'm trying to script a fire ball. I want to replace the Touched
event with Raycast
(this is because of the delay Touched event does)
I'm trying to make it so the Ray moves with the fire ball.
Ray
gets bircks on it's way but the Hit
property fires when the ball reaches that brick.
1 | local ray = Ray.new(Torso.CFrame.p,(Mouse.Hit.p-Torso.CFrame.p).unit* 300 ) |
2 | local Hit,pos = workspace:FindPartOnRayWithIgnoreList(ray, { player.Character,Here } ) |
3 | local distance = ((player.Character.UpperTorso.CFrame).p-pos).magnitude |