This is what I currently have and it doesn't work. There is also no error in the output.
1 | local tools = game.ReplicatedStorage.Tools |
2 |
3 | game.Players.PlayerAdded:Connect( function (player) |
4 | tools.Plank:Clone().Parent = player.Backpack |
5 | end ) |
I had such a problem before. I fixed it by making the ClonedTool a variable
1 | local tools = game.ReplicatedStorage.Tools |
2 |
3 | game.Players.PlayerAdded:Connect( function (player) |
4 | local clonedTool = tools.Plank:Clone() |
5 | clonedTool.Parent = player.Backpack |
6 | end ) |
This feels like the same thing, but it somehow worked for me.
im not sure but i think you define player like uh
1 | player = game.Players |
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:
1 | local tools = game.ReplicatedStorage:WaitForChild( "Tools" ) |
2 | game.Players.PlayerAdded:Connect( function (player) |
3 | tools.Plank:Clone().Parent = player:WaitForChild( "Backpack" ) |
4 | 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.
You maybe need to use CharacterAdded
1 | local tools = game.ReplicatedStorage.Tools |
2 |
3 | game.Players.PlayerAdded:Connect( function (player) |
4 | player.CharacterAdded:Connect( function (character) |
5 | tools.Plank:Clone().Parent = player.Backpack |
6 | end ) |
7 | end ) |
This will wait until the player Character to load before cloning.