I added a dummy into my game to see if this raycast would return it whenever I click and it does but only for one side. I can’t hit it from the opposite side for some reason. Does anyone know what the problem is? If so I’d like some advice on how to fix this issue please!
local remote = game.ReplicatedStorage:WaitForChild("detection")
local player = game.Players.LocalPlayer
remote.OnClientInvoke = function(r)
if player.Character then
local plrchar = player.Character
local humroot = plrchar:FindFirstChild("HumanoidRootPart")
local startPosition = humroot.Position + humroot.CFrame.lookVector
local endPosition = humroot.Position + humroot.CFrame.lookVector * r
local ray = Ray.new(startPosition, endPosition)
local p = workspace:FindPartOnRayWithIgnoreList(ray,plrchar:GetChildren())
local foundPart
if p and p.Parent:FindFirstChild("Humanoid") then
print(p.Parent)
return p.Parent, "No"
end
end
end