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

Why wont the script allow it to keep the weapon?

Asked by 9 years ago

So, I have this figure in which you talk to him to buy the weapons. Now when you buy it you receive it fine, but when you die or reset, it's gun and to get it again you have to buy it again. How can I fix this? Thanks!

script.Parent.DialogChoiceSelected:connect(function(player, choice)
    if (choice:findFirstChild("Cost")) then
        if (player.leaderstats.Money.Value >= choice.Cost.Value) then
            if (game.Lighting:findFirstChild(choice.Name)) then
                player.leaderstats.Money.Value = player.leaderstats.Money.Value - choice.Cost.Value
                local gun = game.Lighting:findFirstChild(choice.Name):clone()
                if (gun.className == "Panzerfaust") then
                    gun.Parent = player.Backpack
                else
                    gun.Parent = player.Character
                end
            end
        end
    end
end)

1 answer

Log in to vote
0
Answered by 9 years ago
script.Parent.DialogChoiceSelected:connect(function(player, choice)
    if (choice:findFirstChild("Cost")) then
        if (player.leaderstats.Money.Value >= choice.Cost.Value) then
            if (game.Lighting:findFirstChild(choice.Name)) then
                player.leaderstats.Money.Value = player.leaderstats.Money.Value - choice.Cost.Value
                local gun = game.Lighting:findFirstChild(choice.Name):clone()
                if (gun.className == "Panzerfaust") then
                    gun.Parent = player.StarterGear
                else
                    gun.Parent = player.Character
                end
            end
        end
    end
end)

StarterGear Will hold if they reset

0
Yeah, but I want to make the script hold it. Not startergear.. alan3401 28 — 9y
Ad

Answer this question