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

Can't add more weapons. Wuuuuuuuuuut?

Asked by 10 years ago

First off, here's the script:

player = script.Parent.Parent.Parent
backpack = player.Backpack

function chooseClass(class)
    for i, v in pairs(class:GetChildren()) do
        if v:IsA("Tool") then
            v:clone().Parent = backpack
        elseif v:IsA("HopperBin") then
            v:clone().Parent = backpack
        elseif v:IsA("Script") then
            local S = v:clone()
            S.Parent = player.Character
            S.Disabled = false
        end
    end
    script.Parent.Main.Visible = false
end

for i, v in pairs(script.Parent.Main:GetChildren()) do
    v.MouseButton1Up:connect(function () chooseClass(v) end)
end

A brother object to this one is the Main, which is a GUI frame. (this whole script is in a GUI btw, better point that out) The children of the frame are buttons called, "Classes." Each button has a Script/Hopperbin that's a weapon. The 4 guns that came with it work fine, however, I added more buttons by copy and pasting, changing the text, and changing the weapon inside the button, and the new guns weren't given to the player like they should've. The first 4 guns work fine, it's the 8 after them. Please note that the new guns are just like the old ones, made by the same person with the same kind of scripts, so I believe the problem isn't in the guns.

1 answer

Log in to vote
0
Answered by 10 years ago

Bump?

Ad

Answer this question