btn1 = script.Parent player = game.Players.LocalPlayer btn1.MouseButton1Down:connect(function() game.Lighting.tools.Dribbler:GetChildren().Parent = player.Backpack end)
please help
What your issue is line 4. The variables being set to local won't change much. I'm trying to understand what you're trying to accomplish. You're either a: Trying to clone 1 tool into the player's backpack b: Trying to clone a set of tools into the player's backpack Since it's hard to tell which you're going for, I'll offer both solutions.
Solution A:
btn1 = script.Parent player = game.Players.LocalPlayer btn1.MouseButton1Down:connect(function() game.Lighting.tools.Dribbler:clone().Parent = player.Backpack end)
Solution B:
btn1 = script.Parent player = game.Players.LocalPlayer btn1.MouseButton1Down:connect(function() for i,v in pairs(game.Lighting.tools.Dribbler:GetChildren()) do v:clone().Parent = player.Backpack end end)
Any questions? Feel free to comment!
You're trying to set a Table's parent. You can't do that.
In order to set all the Children's Parent, you need to set a Generic For loop, something like this:
for _,v in pairs(game.Lighting.tools.Dribbler:GetChildren()) do v:Clone().Parent = player.Backpack end
Also, I'd recommend using game.ReplicatedStorage instead of game.Lighting. Using game.Lighting as an asset storage is deprecated.
Perhaps set the variables as local variables like so
local btn1 = script.Parent local player = game.Players.LocalPlayer btn1.MouseButton1Down:connect(function() game.Lighting.tools.Dribbler:GetChildren().Parent = player.Backpack end)