Having Problem with position

Hi,

I made this game with dialogue and interact with other NPC through GUI.
There is a part of the dialogue where the player would call the NPC
and the NPC would come near to the player. I wanted to teleport the NPC
towards the player. My game is like Doki Doki Literature Club where it only has
few animations.

My goal is to move the NPC towards the player.
The player’s camera is attached to another rigs(R15) head
so it has nothing to do with the players character

The problem is the NPC doesn’t move toward the player instead it stays to it’s
current position(The NPC is far away from the player)

no errors

here is my script:

NameText.Text = player.Name
TypeWriter.typeWrite(DialougeText, "Oh look it's Noob.")
wait(3)
TypeWriter.typeWrite(DialougeText, "It's been along time since the last time we met...")
wait(3.5)
TypeWriter.typeWrite(DialougeText, "I should go and greet him")
wait(3)
TypeWriter.typeWrite(DialougeText, "Hey Noob!")
wait(2)
not_looking:Stop()
looking:Play()
wait(0.30)
stay_looking:Play()
NameText.Text = "Noob"
TypeWriter.typeWrite(DialougeText, "Huh?")
wait(2)
stay_looking:Stop()
Noob_HumRP.Position = Vector3.new(1, 3, 57.5)
wave:Play()
TypeWriter.typeWrite(DialougeText, "Oh hey " .. player.Name)

wait(2)
TypeWriter.typeWrite(DialougeText, "How are you doing today?")
wait(4)
bg2.Visible = true

not_looking = is a animation that I made where the NPC would not look at the player

looking = is also a animation I made where the NPC would look towards the player when
it’s being called

stay_looking = is the same animation as looking but it stays still

wave = is a animation that I took from the emotes(Hello)
this animation will play when the NPC notice the player

The NPC would not go near to the player. Stays on it’s current position(The NPC is far away from the player)

Instead of position, use Noob_HumRP.CFrame = CFrame.new(1, 3, 57.5). I forget why but I think it is related to the way physics constraints are used (welds/joints in the character). If you want to maintain the old orientation, use this instead,

Noob_HumRP.CFrame = Noob_HumRP.CFrame - Noob_HumRP.Position + Vector3.new(1, 3, 57.5)

CFrame holds orientation information so by subtracting the old position and adding the new position, you retain the original orientation.

1 Like

Noob_HUmRP.Humanoid:MoveTo(game.Players.LocalPlayer.Character.HumanoidRootPart.Position)

this script only works in local scripts but this script will work

Noob_HumRP.Humanoid:MoveTo(1, 3, 57.5)

thanks it worked !‎‎‎‎‎‎‎‎ ‎‎‎‎‎‎‎‎‎‎