Hello, I have a guard that is supposed to detect things from a raycast. I have a small invisible part that is anchored in front of the guard. Everytime I go infront of the guard it just prints nil.
Here is the code
local reactiontime = 1
local dir = script.Parent.Dir.Dir
local head = script.Parent.Head
local loop = 0
local distance = 50
while script.Parent.Humanoid.Health > 0 do
wait(reactiontime)
print("Looking")
loop = loop + 1
local lookray = workspace:Raycast(head.Position, dir.Position * distance)
print(lookray)
end
Could anyone please tell me why it only prints nil?
