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

Raycasting not working correctly?

Asked by 9 years ago

I am trying to make a gun that casts a ray out to detect if there is anything for it to hit, but I have run into some trouble. The raycast is not functioning as expected (won't work with an ignore list or creates a ray in a different spot from mouse)

The output is "nil"


local ray = Ray.new(tool.Handle.Position,mouse.Hit.p) local hit, hitPosition = game.Workspace:FindPartOnRay(ray,game.Players.LocalPlayer.Character) print(hit)

Answer this question