How can I make a NPC talk when it reached a certain location after walking? I tried it by using local script and program it to talk when it touch a part but it doesn’t seem to work. may I know how to solve it? (Btw the NPC is able to walk to its destination correctly)
Here is the script
local textchatservice = game:GetService("TextChatService")
script.Parent.Touched:Connect(function(hit)
if hit.Parent.Name == "Rig" then
print("Yes")
textchatservice:DisplayBubble(hit.Parent:WaitForChild("Head"),"Hello! How are you?")
end
end)
Connecting Humanoid.MoveToFinished and then using Humanoid:MoveTo(Position) you can detect when that move to finished
https://create.roblox.com/docs/reference/engine/classes/Humanoid#MoveToFinished
I did use movetofinished when I scripted the npc to walk
so do i use it when i do the talking too?
would be the best option, unless you’re looking to use something like :GetPartsBoundInBox() but this would be redundant
Ok I did that however, it doesn’t seem to work. I used remote events because the displaybubble only work on local scripts. What is wrong with my code?
nevermind I solved it it works now thank you!