The following code uses a "for" loop to clone game.ServerStorage.Tools.Donut (a tool) and give it to a player who joined the game:
game.Players.PlayerAdded:Connect(function(client)
for i = 1, 3 do
repeat wait()
until client:FindFirstChild("Backpack")
local donut = game.ServerStorage.tools.Donut:Clone()
donut.Parent = client.Backpack
end
end)
This didn't work, so I tried putting wait() once the client joins
game.Players.PlayerAdded:Connect(function(client)
wait(5)
for i = 1, 3 do
repeat wait()
until client:FindFirstChild("Backpack")
local donut = game.ServerStorage.tools.Donut:Clone()
donut.Parent = client.Backpack
end
end)
This worked, though. I'm not sure why it's like this. Is it because the player's Character needs to be loaded for them to recieve the tools?
