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?
I hope this helped
game.Players.PlayerAdded:Connect(function(client) wait(5) for i = 1, 3 do -- under this will wait until the character is loaded to receive tools repeat until client.Character:FindFirstChild("HumanoidRootPart") until client:FindFirstChild("Backpack") local donut = game.ServerStorage.tools.Donut:Clone() donut.Parent = client.Backpack end end)