This script seems to be working on studio but does not work when I play the game through ROBLOX player, is there anything that needs to be changed? Thanks! (This is in a Local Script)
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.Frame.Visible = false
script.Parent.Cover.Visible = false
script.Parent.Title.Visible = false
end
function onHumanoidDied(humanoid, player)
script.Parent.Frame.Visible = true
script.Parent.Cover.Visible = true
script.Parent.Title.Visible = true
end
for i, v in pairs(script.Parent.Cover:GetChildren()) do
v.MouseButton1Up:connect(function () chooseClass(v) end)
end

3 comments
Is is in a local script? "Game.Players.LocalPlayer" is a better way to see what player has the local script.
I've been having the same problem with different types of scripts.
Well, the lag would be a cause. This script doesnt wait for the children.. Things like that and if the script is local, if you have changed studio settings, and a few other things can effect it.. Knowing if it gives an error helps. Also learning to use the LuaDebugger