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

How can I make an npc give you an item after a "DialogChoice" is selected?

Asked by
clrik 8
6 years ago
Edited 6 years ago

I have been wondering, if a certain dialog is selected, then can I like make the NPC give you an item?

Part of script that needs an "Item Giver" part to it.

script.Parent.DialogChoiceSelected:connect(function(Player, Choice)

if Choice.Name == "DialogChoice" then

--- Item Giver Script

Also can this work on a custom dialog? I can still wonder... Custom Dialog

Basically once a certain text is done (on keypress [E]), the NPC gives you an item.

Regular Dialog

Same thing as the custom dialog but just using the regular dialog.

NPC giving you items

This part is the main script. I tried using one of those "Giver" scripts but that didn't work out too well if I could have some help I would greatly appreciate it.

0
Firstly, none of those scripts look outdated. They don't use deprecated methods, which is good, except that with the second script, Scriptable should have an uppercase S; but what exactly are you trying to do? UgOsMiLy 1074 — 6y

1 answer

Log in to vote
0
Answered by
Nonaz_jr 439 Moderation Voter
6 years ago

listen to DialogChoiceSelected, a property of the dialog.

http://wiki.roblox.com/index.php?title=Usage_of_dialogs

If you want to mka eyour game filteringEnabled, listen to the DialogChoiceSelected in a localscript, fire an event, and have the event award the item, by copying the item from serverstorage into the player (who's client fired the event)'s backpack.

Similar approach for a custom gui, but now the localscript doesn't listen to dialogChoiceSelected but to a GUI button press.

0
you changed your post: You can also make your localscript in your custom GUI listen to kepress E to fire the event. Nonaz_jr 439 — 6y
0
How do I do that? You should show me. . . clrik 8 — 6y
Ad

Answer this question