NPC teleports back when i teleport him

Hello! I am making a game currently but i have a problem. I want to make that you have two options in a Menu, and you can choose the option that you want to spawn a bot.
I made that when you press that button the NPC teleports, from a empty room in the baseplate, to a position on the map. When the NPC teleports, it instantly teleports back to the position it was before. Idk why?! If you have any ideas how i can fix this or a other way to do that, i would be thankful.

Here the Code:

script.Parent.MouseButton1Down:Connect(function()
//thats ui
    script.Parent.Parent.Parent.Parent.Visible = false 
	script.Parent.Parent.Parent.Parent.Header.Visible = true
	script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Visible = false
	script.Parent.Parent.Parent.Parent.Header2.Visible = true
//thats the teleport thing
	local Enemy = game.Workspace:WaitForChild("Enemy")
	Enemy:MoveTo(Vector3.new(123.805, 8.173, -321.671))
	print("movedbot")
end)

Fixed it myself. Used ReplicatedStorage and Parent function

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