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

Can someone help me with the scripts of a DialogShop? Please.. [closed]

Asked by 7 years ago
Edited 7 years ago

Dear, best reader

I'll ask anybody to help me for a DialogShop, mine doesn't work.. So i hope, if you read this and you know how, please send me a script or something.

Thanks already, Greetings, bartjenl

0
This is not a request site. Please include an attempt or your question will most likely be flagged for moderation. TheHospitalDev 1134 — 7y

Closed as Not Constructive by farrizbb and antonio6643

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
0
Answered by 7 years ago
local dialog = script.Parent
dialog.DialogChoiceSelected:connect(function(player, choice)
    -- Check the player has a stats object
    local stats = player:FindFirstChild('leaderstats')
    if not stats then return end

    -- And that the stats object contains a gold member
    local gold = stats:FindFirstChild('Gold')
    if not gold then return end

    if choice == script.Parent.DialogChoice.ChoiceA then
        if gold.Value >= 5 then -- 5 is the amount of gold you need to purchase this weapon
            game.ReplicatedStorage.Weapon1:Clone().Parent = player.Backpack
            gold.Value = gold.Value - 5 -- subtract the amount of gold you need to purchase
        end
    elseif choice == dialog.DialogChoice.ChoiceB then
        if gold.Value >= 10 then
            game.ReplicatedStorage.Weapon2:Clone().Parent = player.Backpack
            gold.Value = gold.Value - 10
        end
    elseif choice == dialog.DialogChoice.ChoiceC then
        if gold.Value >= 15 then
            game.ReplicatedStorage.Weapon3:Clone().Parent = player.Backpack
            gold.Value = gold.Value - 15
        end
    end
end)
Ad