Assign Class script not working?
So I edited this Assign Class script to fit my game and weapons. It is a Local Script, and works fine in ROBLOX Studio solo, but whenever I go to test in on a server or in game, it doesn't work.
Basically what happens is it will give the player the tool, but nothing happens when I try to equip it. The gun scripts I have are pretty "fancy" as well, and are supposed to put the gun on the player's back if it is unequipped (and have a special equipped animation). However, as I mentioned, nothing happens, and whenever I equip the gun (which is not even there), my player's arms don't even move.
Here is the script:
01 | local player = script.Parent.Parent.Parent |
02 | backpack = player.Backpack |
04 | function chooseClass(class) |
05 | for i, v in pairs (backpack:GetChildren()) do v:remove() end |
06 | for i, v in pairs (class:GetChildren()) do |
08 | v:clone().Parent = backpack |
09 | elseif v:IsA( "HopperBin" ) then |
10 | v:clone().Parent = backpack |
13 | script.Parent.Main.Visible = false |
15 | script.Parent.Main.Visible = false |
18 | for i, v in pairs (script.Parent.Main:GetChildren()) do |
19 | v.MouseButton 1 Up:connect( function () chooseClass(v) end ) |
Output doesn't say anything either.