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)
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)
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.
im not sure but i think you define player like uh
player = game.Players
or something like this
bro what? smh
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.
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.
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
is it in a local script or a normal script?
It is probably in a normal script because I think that is the only way to access it on a server script.