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

DialogChoiceSelected does not work in FE or is it my code?

Asked by 5 years ago
Edited by User#24403 5 years ago

I'm currently am trying to make a dialog shop but it's not working i'm not sure if its the actually roblox function or just my code. here's my code ```lua local dialog = script.Parent local drinks = game.ServerStorage.Coffee dialog.DialogChoiceSelected:connect(function(player,choice) -- Check the player has a stats object local stats = player:FindFirstChild('leaderstats') if not stats then print('NO STAts') end

-- And that the stats object contains a gold member local Cash = stats:FindFirstChild('Cash') if not Cash then print('NO CASh') end

-- Coffee's if choice == script.Parent.DialogChoice.Coffee.Cocoa then if Cash.Value >= 5 then -- 5 is the amount of gold you need to purchase this weapon drinks.Cocoa:Clone().Parent = player.Backpack Cash.Value = Cash.Value - 5 -- subtract the amount of gold you need to purchase end elseif choice == script.Parent.DialogChoice.Coffee.Decaf then if Cash.Value >= 5 then drinks.Decaf:Clone().Parent = player.Backpack Cash.Value = Cash.Value - 5 end elseif choice == script.Parent.DialogChoice.Coffee.Frappe then if Cash.Value >= 5 then drinks.Frappe:Clone().Parent = player.Backpack Cash.Value = Cash.Value - 5 end elseif choice == script.Parent.DialogChoice.Coffee.Latte then if Cash.Value >= 5 then drinks.Latte:Clone().Parent = player.Backpack Cash.Value = Cash.Value - 5 end elseif choice == script.Parent.DialogChoice.Coffee.Mocha then if Cash.Value >= 5 then drinks.Mocha:Clone().Parent = player.Backpack Cash.Value = Cash.Value - 5 end elseif choice == script.Parent.DialogChoice.Coffee.Regular then if Cash.Value >= 5 then drinks.Regular:Clone().Parent = player.Backpack Cash.Value = Cash.Value - 5 end end end) ```

Answer this question