So, i'm trying to have the "NPC" to move to the player if the player touches the brick. When the player touches the brick, it would find its name and then go to the player that is touching that brick. There aren't any errors int he output and this is very stressful as I have no where to look for my mistake.

LW = game.Workspace.zone.LW
Mid = game.Workspace.zone.Mid
OPG = game.Workspace.zone.OPG
RW = game.Workspace.zone.RW
z1 = game.Workspace.zone.Zones.z1
z2 = game.Workspace.zone.Zones.z2
z3 = game.Workspace.zone.Zones.z3
z4 = game.Workspace.zone.Zones.z4
opg1 = false
lw1 = false
mid1 = false
rw1 = false

z1.Touched:connect(function()
	if opg1 == false then
		opg1 = true
		while opg1 == true do
			local plr = game.Players:GetPlayers()
			for i,v in pairs(plr) do
				if v == v.Name  then
					print("found player")
					game.Workspace.zone.OPG.Humanoid.WalkToPoint = game.Workspace.v.Name.Torso.Position
					end			
			wait()
			end
		end
	else 
		return false
	end
end)

1 comment

0

http://wiki.roblox.com/index.php?title=API:Class/Humanoid/Move if you wanna make the NPC walk, call this function instead.