Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why isn't the NPC moving to the player once the certain brick is touched?

So I'm trying to have the clone(NPC) move to the player once the player touches its brick/zone, then once it leaves it returns to the original position, but I haven't done that yet. Whenever I touch the brick that the NPC is supposed to respond to, it just stays there, it doesn't move.

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(hit)
	
	local character= script.Parent:FindFirstChild("Humanoid")
	
			if character then
					print("it works")
				opg1 = true
				while opg1 == true do
				OPG.Humanoid:MoveTo(game.Workspace.Player.Humanoid)
				wait()

				end
			else
				return false
	end
end)

1 answer

The reason why its not working is because you're using the method MoveTo() wrong. The method MoveTo requires a Vector3 position inside of its parenthesis. Replace the game.Workspace.Player.Humanoid with game.Workspace.Player.Torso.Position!

~UserOnly20Charcters, Hoped I helped you to answer your question! If you have any further question, don't hesitate to comment below!!

4 comments

0

This is off topic, but did you copy my signature style ?? :P idk, just looks similar

0

I tried it with your tip, but it didn't work, the clone just stood there.

0

@TheDealyPanther I didn't even know you had your own Signature style let alone copy it.

0

@tyler46783 I don't why it shouldn't work. Maybe the configuration of your NBC is out of place.

This discussion is preserved as it was. New answers, comments, and votes are closed.