Help with DialogChoiceSelected

I wanted to make a script that awards a player with a badge when they find a hidden easter egg by selecting a dialog choice.

I’ve tried looking at other DevForum posts, but I keep getting the same error when I try running a function when a dialog choice is selected:

DialogChoiceSelected is not a valid member of DialogChoice “Workspace.42.Model.DialogHandle.Dialog.42Path.DialogChoice”

I’m not sure what I’m doing wrong. My script is a LocalScript in StarterPlayerScripts, and I followed all of the instructions of other DevForum posts. Is this feature outdated?

My script:

game.Workspace["42"].Model.DialogHandle.Dialog["42Path"].DialogChoice.DialogChoiceSelected:Connect(function(player, choice)
	print(player)
end)

Path:
Note that the model, “42” is located in game.Workspace
image

3 Likes

DialogChoiceSelected is a dialog event, not a DialogChoice event

workspace:WaitForChild("42"):WaitForChild("Model"):WaitForChild("DialogHandle"):WaitForChild("Dialog").DialogChoiceSelected:Connect(function(Player, Choice)
	if Choice == workspace["42"].Model.DialogHandle.Dialog["42Path"] then
		print(Player.Name)
	end
end)

This should work. Choice is the DialogChoice instance.

4 Likes

Thank you! This worked for me.