Seen in this video I have a Character pathfinding to the player. One of the determining factors of whether or not the Character follows the player is whether it can see the player or not, this information is found using Ray Casting, the window on the left side of the screen is the server side and the output is saying that the character can see the player even though the player is behind a wall; I’ve tried many things to see if there was another issue in my code that was causing problems but I couldn’t find any.
local Raycast = workspace:Raycast(character.HumanoidRootPart.Position,player.Character.HumanoidRootPart.Position,RayParams)
if Raycast then --Debug purposes
print("Object blocking Ray: ".. Raycast.Instance.Name) --Debug purposes
end
if Raycast == nil or Raycast and Raycast.Instance.Parent == player.Character then
print("player is seen")
NearestPlayer = player
destination = player.Character.PrimaryPart.Position
NearestPlayerDistance = (player.Character.PrimaryPart.Position - character.PrimaryPart.Position).Magnitude
end