I'm helping with designing a house for someone's game and thought she would like to have some tour guide,after I saw and explored the Humanoid controls.I tried making a script to make the guide to walk to a certain point/room if you ask the guide where that room is(e.g. someone wants to know where the kitchen is,he asks "where is the kitchen" and the guide will walk to the kitchen and stand there).
Since I'm not good at scripting,I thought I had this one right.Would anyone fix or at least point out my errors?
guide = script.Parent
function onChatted(msg, recipient, speaker)
local source = string.lower(speaker.Name)
msg = string.lower(msg)
if (msg == "show me the kitchen") then
guide.Humanoid.WalkToPoint = 10.571, 1.188, -58.499
end
end
function onPlayerEntered(newPlayer)
newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end)
end
game.Players.ChildAdded:connect(onPlayerEntered)
I have put the coordinates directly into the WalkToPoint control,and the bot walked to that point and stopped.It's not the coordinates or the bot,it's the script. |