Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why is my NPC dialog choice selected script not working?

Trying to make a quest system using an NPC but I'm having no luck with the simplest thing.

This script:

script.Parent.DialogChoiceSelected:Connect(function(player,choice)
	print(player.Name,choice.Name)
end)

Prints nothing and returns no errors when I talk to the NPC.

I started off by looking at the Wiki page for it and I saw nothing wrong with what I did. I tried it in a local script to see if it was something FE and it also printed and returned nothing. I'm assuming it's a simple thing I'm doing wrong but I don't know what.

Here is a picture of where the script is:

Picture of script location

2 answers

Edit: Keep it a LocalScript, but replace it with this code:

script.Parent.DialogChoiceSelected:Connect(function(choice)
	local playerName = game.Players.LocalPlayer.Name
	print(playerName)
	print(choice.Name)
end)

Let's hope this works, because I don't have time to answer this thoroughly.

4 comments

0

I tried making it a local script and it still returned nothing. Is there any other reason for that?

0

I see what you did. You used the Roblox Studio website example. Don't use those, as they do not work most of the time.

0

@recanman - Still does not work and there are no errors...

0

Huh. This works for me, so there must be something wrong with your place.

Edit: Keep it a LocalScript, but replace it with this code:

script.Parent.DialogChoiceSelected:Connect(function(choice) local playerName = game.Players.LocalPlayer.Name print(playerName) print(choice.Name) end) Let’s hope this works, because I don’t have time to answer this thoroughly.

Problem in this script is:

script.Parent

If you add your choice next to:

script.Parent["Name Of Choice"]

It will select choice not dialog, or you can instert this script to choice, but if you insert this script to dialog it will define choice as dialog and it will not work.

This discussion is preserved as it was. New answers, comments, and votes are closed.