Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Why does my NPC not think I'm in it's sight even when I am?

Asked by 4 years ago

So I need to program an NPC so that it'll detect the player if it spots suspicious activity. Here's the script I made:

001local npc = script.Parent
002local iconGui = script.Parent.Head.aiGui
003local triggerPart = npc.DetectionPart.Handle
004local itemsInSight = {}
005local eis = false
006local curChar = nil
007local num = 0
008local R = 0
009local B = 200
010local npcStatus = script.Parent["NPC Status"]
011local detected = false
012 
013triggerPart.Touched:Connect(function(hit)
014    print("New item-in-sight!")
015    if game.Players:GetPlayerFromCharacter(hit.Parent) then
View all 205 lines...

I really have to solve this for the game (actively working on tutorial) and help would be appreciated. Thanks!

RAID (friends access): roblox.com/games/6034647915/RAID

Answer this question