NPC dialog not working

Hi, i try to make a dialog but it’s not work, i have made this in a localscript but the print is’nt fire…

script.Parent.DialogChoiceSelected:connect(function(player,choice)
	if choice.Name == "Yes" then
		print("yes")
	elseif choice.Name == "No" then
		print("no")
	end
end)

What is the parent of the Dialog?

The parent of Dialog is the Head of my PNJ

Is your PNJ a player’s character, because it seems to be some sort of character.

I think the dialog should be a server script AFAIK cause the parent of the dialog would be on workspace.

It’s just a model PNJ take in toolbox

I have try to make this code in serverscript but it’s not working too…

Then that’s the problem. It’s not a player’s character. LocalScripts do not run when they are not parented to either ReplicatedFirst, a player’s PlayerScripts, the player’s character, a player’s PlayerGui, or the player’s Backpack. Move the LocalScript to one of these and see if it works.

1 Like

first of all workspace cant be with local script, and you no need to script the roblox dialog for this thing. the “GoodbyeChoinceActive” let to the player leave the dialog. and the UserDialog let to the player start the dialog.

Oh yes thank you ^^ it’s work now :slight_smile: