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

Tool not cloning to backpack?

Asked by 3 years ago

This is what I currently have and it doesn't work. There is also no error in the output.

local tools = game.ReplicatedStorage.Tools

game.Players.PlayerAdded:Connect(function(player)
    tools.Plank:Clone().Parent = player.Backpack
end)

0
is it in a local script or a normal script? Gmorcad12345 434 — 3y
0
It is probably in a normal script because I think that is the only way to access it on a server script. Finty_james 269 — 3y

4 answers

Log in to vote
1
Answered by 3 years ago

I had such a problem before. I fixed it by making the ClonedTool a variable

local tools = game.ReplicatedStorage.Tools

game.Players.PlayerAdded:Connect(function(player)
    local clonedTool = tools.Plank:Clone()
    clonedTool.Parent = player.Backpack
end)

This feels like the same thing, but it somehow worked for me.

Ad
Log in to vote
0
Answered by 3 years ago

im not sure but i think you define player like uh

player = game.Players
0
or something like this 54k_Bandzzzz 0 — 3y
0
bro what? smh Dehydrocapsaicin 483 — 3y
Log in to vote
0
Answered by 3 years ago

Maybe the backpack wasn't loaded in yet when the script was loaded. Try :WaitForChild() or check if the backpack is loaded and then select it. Here is an example:

local tools = game.ReplicatedStorage:WaitForChild("Tools")
game.Players.PlayerAdded:Connect(function(player)
tools.Plank:Clone().Parent = player:WaitForChild("Backpack")
end)

By doing this, your waiting for the backpack to load, and once it loads, the tool will be in the backpack! Also tools.Plank:Clone() should be in a variable.

Log in to vote
0
Answered by 3 years ago

You maybe need to use CharacterAdded

local tools = game.ReplicatedStorage.Tools

game.Players.PlayerAdded:Connect(function(player)
   player.CharacterAdded:Connect(function(character)
    tools.Plank:Clone().Parent = player.Backpack
     end)
end)

This will wait until the player Character to load before cloning.

Answer this question