Blind Npc Script

İm making a game like Doors and i need an Aİ script for Figure but dont know how to code a blind npc script can someone help please

Its easy, most of the blind npcs checks if player is crouching or not (can be done with bool values or attributes) and you can use Humanoid.MoveDirection to check if player is walking or not.

heres a basic example:

local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()

local humanoid = char:WaitForChild("Humanoid")

if not plr:GetAttribute("crouching") then
	plr:SetAttribute("crouching",false)
end

game.UserInputService.InputBegan:Connect(function(i)
	if i.KeyCode == Enum.KeyCode.C then
		plr:SetAttribute("crouching",true)
	end
end)

game.UserInputService.InputEnded:Connect(function(i)
	if i.KeyCode == Enum.KeyCode.C then
		plr:SetAttribute("crouching",false)
	end
end)

game["Run Service"].RenderStepped:Connect(function(delta)
	if humanoid.MoveDirection ~= Vector3.new() and not plr:GetAttribute("crouching") then
		print('Player is moving, heared a sound.')
	end
end)

(This script is just an example, so fix it and make it safe from the exploiters)

1 Like

İ want the npc to attack when heard a sound can you do that? idk much coding im beginner

Do you know how to use remote events?

Yea but a beginner level scripter

You should watch pathfinding tutorials to figure out how to do that. It seems like you are pretty much asking for him to make you the entire script. A little tip for the devforum is to not ask for people to make you an entire script but rather help you understand something or solve an issue.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.