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

Why does this Assign Class script not work?

Asked by 8 years ago

The script is in the GUI itself. When you click on a class, the tool is supposed to clone and be placed in the player's backpack (until they die, upon which they can choose a new class). Filtering Enabled is on. Help needed.

player = script.Parent.Parent.Parent 
backpack = player.Backpack
function chooseClass(class)
    for i, v in pairs(backpack:GetChildren()) do v:remove() end
    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
        end
    end
    script.Parent.Main.Visible = false --no new class for a little bit
    wait(3454350)
    script.Parent.Main.Visible = false --allow to pick a different class
end

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

0
It might be the wait(3454350) That's waiting over a week(if I did the math right) theCJarmy7 1293 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

If filtering enabled is on you may need a Remotefunction to complete this task.

Ad

Answer this question