I need a classic dialog shop for my game, and I found this script that works perfectly well in studio, but when I play online, I don't get what I asked for.
I think the problem is that the script I'm using is a Script and not a LocalScript, but when I put this into a LocalScript, it didn't work even in studio. This is just my amateur opinion, but I think it has something to do with the line gun.Parent=player.Backpack Maybe it doesn't know who player is when online?
script.Parent.DialogChoiceSelected:connect(function(player, choice)
if (choice == script.Parent.Choice1) then
gun = game.Lighting["Coffee"]:clone() --The exact name of the tool/weapon the player will get.
print "Cloned Coffee"
gun.Parent = player.Backpack
script.Parent.Choice1.ResponseDialog = "Sure!"
end
if (choice == script.Parent.Choice2) then
gun = game.Lighting["Pretty Good Snax "]:clone() --The exact name of the tool/weapon the player will get. Print "Snax"
gun.Parent = player.Backpack
script.Parent.Choice1.ResponseDialog = "Sure!"
end
if (choice == script.Parent.Choice3) then
gun = game.Lighting["Expired Elixir"]:clone() --The exact name of the tool/weapon the player will get.
gun.Parent = player.Backpack
script.Parent.Choice1.ResponseDialog = "Sure...!"
end
if (choice == script.Parent.Choice4) then
gun = game.Lighting[" "]:clone() --The exact name of the tool/weapon the player will get.
gun.Parent = player.Backpack
script.Parent.Choice1.ResponseDialog = "Sorry...!"
end
end)
