Ok, this is a weird one. So I have this tool giver system that inserts tools into the player’s StarterGear and Backpack when they join. But thing is, is that it doesn’t always give the player the tool.
The script even prints when the tool is being inserted, but the tool sometimes doesn’t get added, as shown below:
ignore error, its an old tool script
Does anyone know why this is happening? Some help will be greatly appreciated as always. Thank you!
Script:
Players = game:GetService("Players")
RS = game:GetService("ReplicatedStorage")
ToolsFolder = RS:WaitForChild("StarterTools")
-- Accessing StarterGear from Server Script
function onPlayerAdded(player)
local starterGear = player:WaitForChild("StarterGear")
local backpack = player:WaitForChild("Backpack")
for i, Tool in ipairs(ToolsFolder:GetChildren()) do
local NewTool = Tool:Clone()
NewTool.Parent = starterGear
local NewTool2 = Tool:Clone()
NewTool.Parent = backpack
print("Gave " .. Tool.Name .. " to " .. player.Name)
end
end
Players.PlayerAdded:connect(onPlayerAdded)
for i, v in next, Players:GetPlayers() do
onPlayerAdded(v)
end