I have made a simple look detection for my 096 scripts, but if I look backward or forward towards him, he activates. But if I look to the side he doesn't.
I was to look directly at him towards the front of the player.
function checksee()
while heartbeat:wait() do
for i,v in pairs(workspace:GetChildren()) do
if v.ClassName == "Model" and v ~= script.Parent then
print("working")
local characterhumanoid = v:findFirstChildOfClass("Humanoid")
local characterLdet = v:findFirstChild("Head")
local characterhead = script.Parent:findFirstChild("Head")
if characterhumanoid and characterLdet then
if characterhumanoid.Health > 0 then
if (characterLdet.Position - script.Parent.Head.Position).magnitude < 75 then
if characterLdet.Orientation.y > characterhead.Orientation.y then
if angered == false then
angered = true
script.Parent.Head.face.Texture = "http://www.roblox.com/asset/?id=2651222659"
print("I got stared at by "..v.Name)
script.Parent.Humanoid.WalkSpeed = 0
script.Parent.Head.Docile:Stop()
script.Parent.Head.DocileToRage:Play()
script.Parent.Head.DocileToRage.Ended:Wait()
script.Parent.Head.Rage:Play()
script.Parent.Humanoid.WalkSpeed = 21
kill = true
wait(15)
script.Parent.Head.face.Texture = "http://www.roblox.com/asset/?id=861024822"
kill = false
script.Parent.Head.Rage:Stop()
script.Parent.Head.RageToDocile:Play()
script.Parent.Head.RageToDocile.Ended:Wait()
script.Parent.Head.Docile:Play()
angered = false
wait(7)
end
end
end
end
end
end
end
end
end
