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 10 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!

01script.Parent.DialogChoiceSelected:connect(function(player, choice)
02    if (choice:findFirstChild("Cost")) then
03        if (player.leaderstats.Money.Value >= choice.Cost.Value) then
04            if (game.Lighting:findFirstChild(choice.Name)) then
05                player.leaderstats.Money.Value = player.leaderstats.Money.Value - choice.Cost.Value
06                local gun = game.Lighting:findFirstChild(choice.Name):clone()
07                if (gun.className == "Panzerfaust") then
08                    gun.Parent = player.Backpack
09                else
10                    gun.Parent = player.Character
11                end
12            end
13        end
14    end
15end)

1 answer

Log in to vote
0
Answered by 10 years ago
01script.Parent.DialogChoiceSelected:connect(function(player, choice)
02    if (choice:findFirstChild("Cost")) then
03        if (player.leaderstats.Money.Value >= choice.Cost.Value) then
04            if (game.Lighting:findFirstChild(choice.Name)) then
05                player.leaderstats.Money.Value = player.leaderstats.Money.Value - choice.Cost.Value
06                local gun = game.Lighting:findFirstChild(choice.Name):clone()
07                if (gun.className == "Panzerfaust") then
08                    gun.Parent = player.StarterGear
09                else
10                    gun.Parent = player.Character
11                end
12            end
13        end
14    end
15end)

StarterGear Will hold if they reset

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

Answer this question