Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why wont the script allow it to keep the weapon?

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

✓ Accepted answer
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

1 comment

0

Yeah, but I want to make the script hold it. Not startergear..

This discussion is preserved as it was. New answers, comments, and votes are closed.