Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Why is my NPC dialog choice selected script not working?

Asked by 5 years ago
Edited 5 years ago

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

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago

Edit: Keep it a LocalScript, but replace it with this code: <pre>script.Parent.DialogChoiceSelected:Connect(function(choice) local playerName = game.Players.LocalPlayer.Name print(playerName) print(choice.Name) end)</pre> Let's hope this works, because I don't have time to answer this thoroughly.

0
I tried making it a local script and it still returned nothing. Is there any other reason for that? xXGokyXx 46 — 5y
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. recanman 88 — 5y
0
@recanman - Still does not work and there are no errors... xXGokyXx 46 — 5y
0
Huh. This works for me, so there must be something wrong with your place. recanman 88 — 5y
Ad
Log in to vote
0
Answered by
enes223 327 Moderation Voter
5 years ago

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.

Answer this question