How do i make when an NPC looks at you, Increases His Speed + 1 every 1 second?

The title explains it all, but. What method i should use and how?, i was thinking of an hitbox very large, but In front of it idk

Next time you post here, please keep in mind this is a place to get help, not for people to create things for you. Either way…

CFrame ObjectSpace is ideal for this. It’s relatively simple, all it is is this:

Npc_CFrame:ToObjectSpace(PlayerCFrame).Z

For example:


Psuedocode:

while true do
	for i,v in pairs(game:GetService("Players"):GetPlayers()) do
		if Npc_CFrame:ToObjectSpace(v.CFrame).Z < 0 then
			Npc.Humanoid.WalkSpeed += 1
			break
		end
	end
	task.wait(1)
end

Keep in mind this pseudocode is just an example as it isn’t meant to be used as-is, and it doesn’t account for range.

1 Like

Yeah… Sorry, but thanks anyways!