How would I use NPC dialog to give a player an item?

I want to make it so when you chose a certain dialog option it will give you a tool but I cannot figure it out properly and a link that would have helped on the developer roblox site is a dead link now.

4 Likes

Use the Dialog.DialogChoiceSelected event

Example script

Dialog.DialogChoiceSelected:Connect(function(Player,Choice)
    if Choice.Name == "NameOfDialogChoiceOption" then
        local clone = tool:Clone()
        clone.Parent = Player.Backpack
    end
end)
8 Likes

oh cool thanks dude, that was really fast

2 Likes

How would I choose what tool it would give? Like a basic roblox sword. and in the script I see two blue lines. are those bad? Iā€™m kinda new to scripting.

2 Likes