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

Dialog Shop broken, nothing mentioned in the output. Why?

Asked by 6 years ago

Ok, yesterday, I modified my shop but it didn't work like many times before.

It just keeps being broke or being still messed up in a way, so.

What's the current problem?

No output problems.

local dialog = game.Workspace.BillzFifto.Dialog --nicknames game.Workspace.BillzFifto.Dialog to just dialog
dialog.DialogChoiceSelected:connect(function(player, choice) -- connects dialogs and choices
    -- Check the player has a stats object
    local stats = player:FindFirstChild('leaderstats')
    if not stats then return end --stats!


    local Coins = stats:FindFirstChild('Coins')
    if not Coins then return end   --Checks to see if coins exist

    if choice == dialog.DialogChoice["SCAR-H RDS"] then --checks dialog choice  
        if Coins.Value >= 200 then --checks player's balance
            game.ReplicatedStorage["SCAR-H RDS"]:Clone().Parent = player.Backpack --Clones the boi
            game.ReplicatedStorage["SCAR-H RDS"]:Clone().Parent = player.StarterGear
            Coins.Value = Coins.Value - 200 --Takes the amount away
        end 
    elseif choice == dialog.DialogChoice["Minigun"] then -- The rest is too similar to explain
        if Coins.Value >= 1000 then
            game.ReplicatedStorage.Minigun:Clone().Parent = player.Backpack
            game.ReplicatedStorage.Minigun:Clone().Parent = player.StarterGear
            Coins.Value = Coins.Value - 1000
        end
     elseif choice == dialog.DialogChoice["SPMP-57"] then
        if Coins.Value >= 100 then
            game.ReplicatedStorage["SPMP-57"]:Clone().Parent = player.Backpack
            game.ReplicatedStorage["SPMP-57"]:Clone().Parent = player.StarterGear
            Coins.Value = Coins.Value - 100
        end
      elseif choice == dialog.DialogChoice["PMA-MORS-9"] then
        if Coins.Value >= 750 then
            game.ReplicatedStorage["PMA-MORS-9"]:Clone().Parent = player.Backpack
            game.ReplicatedStorage["PMA-MORS-9"]:Clone().Parent = player.StarterGear
            Coins.Value = Coins.Value - 750
        end
       elseif choice == dialog.DialogChoice["FN Minimi[S]"] then
         if Coins.Value >= 500 then
             game.ReplicatedStorage["FN Minimi[S]"]:Clone().Parent = player.Backpack
             game.ReplicatedStorage["FN Minimi[S]"]:Clone().Parent = player.StarterGear     
             Coins.Value = Coins.Value - 500
         end
        elseif choice ==dialog.DialogChoice["Arisaka(AntiMatter Rounds)"] then
          if Coins.Value >= 800 then
              game.ReplicatedStorage["Arisaka(AntiMatter Rounds)"]:Clone().Parent = player.Backpack
              game.ReplicatedStorage["Arisaka(AntiMatter Rounds)"]:Clone().Parent = player.StarterGear
              Coins.Value = Coins.Value - 500
        end
    end
end


1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago
script.Parent.DialogChoiceSelected:connect(function(player, choice) if (choice == script.Parent.Choice1) then if (player.leaderstats.Cash.Value >= 2000) then gun = game.Lighting.Gunhere:Clone() gun.Parent = player.Backpack player.leaderstats.Cash.Value = player.leaderstats.Cash.Value - 2000 script.Parent.Choice1.ResponseDialog = "Have a nice day!" else script.Parent.Choice1.ResponseDialog = "You don't have enough Money!" end return end end)

You need to do that for each choice. Must be in a dialog with 2 dialog choices

Named: Choice1, and Choice2 you can make more.
0
please use codeblock robertwoodsy5115 16 — 6y
0
Fixed. DevelopingUnlimited -6 — 6y
Ad

Answer this question