Help needed making a Work At A Pizza Place NPC customer

Hello developers.

I’m trying to make a NPC, like work at a pizza place where a customer walks up to the counter and a Dialog comes up above their head Saying something like “Hello”, then the player responds with 3 options, one option being correct. Then the player presses the button with a picture of the item they asked for (like a coffee button) if they asked for coffee. I’ve struggled to do this for the past hour and a half. This is the only script I have so far, I really need help on this project. Any advice or help is appreciated, thanks :slight_smile:.



local options = {"Hi what can I get for you today?", "Go away!", "You suck!"
}

while wait(1) do
script.Parent.WalkToPoint = script.Parent.Parent.Parent.PointB.Position

wait(.1)
	local p = script.Parent.Parent.Head.Dialog.DialogChoice
	local p1 = script.Parent.Parent.Head.Dialog.DialogChoice1
	local p2 = script.Parent.Parent.Head.Dialog.DialogChoice2
	p.UserDialog = options[math.random(1, #options)]
	p.ResponseDialog = choices[math.random(1, #choices)]
	p1.ResponseDialog = choices[math.random(1, #choices)]
	p2.ResponseDialog = choices[math.random(1, #choices)]
end 

script.Parent.WalkToPoint = script.Parent.Parent.Parent.PointA.Position 
1 Like

Does it not work?
If you’re trying to ask how to do said menu, connect it to a server script via a remote event. When ever the player presses a button, have it also send a server event.
The server script should check if the player pressed the right button.

Well there are multiple problems, the chats keep coming up with like “…” and the options aren’t randomizing.

The table choices was never defined. I think you meant to rename the table options as choices and define a new table called options for the first thing the NPC says.

1 Like