So I be tryin' to sell 5 potatoes (Potato) for 5 experience points (XP) 'ere in this dialog. When I try it, it takes no potato nor gives any XP! What's the error? It must be in the script, since the routes outside it have been checked.
local dialog = script.Parent
dialog.DialogChoiceSelected:connect(function(player, choice)
local stats = player:FindFirstChild('leaderstats')
if not stats then return end
local Gold = stats:FindFirstChild('Potato')
if not Gold then return end
if choice == script.Parent.DialogChoice.ChoiceA then
if Gold.Value <= 5 then
stats:findFirstChild('XP')
XP.Value = XP.Value + 5
stats:findFirstChild('Potato')
Potato.Value = Potato.Value - 5
end
end
end)

2 comments
Line 10, try greater than or equal to 5
no effect, but that was a good point. :S My head is about to explode, what is wrong with this