Why does this Assign Class script not work?
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.
01 | player = script.Parent.Parent.Parent |
02 | backpack = player.Backpack |
03 | function chooseClass(class) |
04 | for i, v in pairs (backpack:GetChildren()) do v:remove() end |
05 | for i, v in pairs (class:GetChildren()) do |
07 | v:clone().Parent = backpack |
08 | elseif v:IsA( "HopperBin" ) then |
09 | v:clone().Parent = backpack |
12 | script.Parent.Main.Visible = false |
14 | script.Parent.Main.Visible = false |
17 | for i, v in pairs (script.Parent.Main:GetChildren()) do |
18 | v.MouseButton 1 Up:connect( function () chooseClass(v) end ) |