Camera:ViewportPointToRay End Up Shooting Own persons Head

How do I make it not shoot at the own player??

				local r = Camera:ViewportPointToRay(Camera.ViewportSize.X/2,Camera.ViewportSize.Y/2-game:GetService("GuiService"):GetGuiInset().Y/2)

They in first person

1 Like

help why it does this ?? wy why??!?? why???

local Params = RaycastParams.new()
Params.FilterType = Enum.RaycastFilterType.Blacklist
Params.FilterDescendantsInstances = {plr.Character:GetDescendants()} -- Add items you don't want the ray to hit. 

local VPRay = Camera:ViewportPointToRay(Camera.ViewportSize.X/2,Camera.ViewportSize.Y/2-game:GetService("GuiService"):GetGuiInset().Y/2)
local r = workspace:Raycast(VPRay.Origin, VPRay.Direction * 500, Params)  --You don't have to limit the length of the ray to 500 - please change this if you plan on going beyond that. 

Or you can just utilize the third (depth) argument in ViewportPointToRay, but I’ve personally encountered some bugs that I’m not fond of using that.