My problem is pretty simple. I want to connect equipped and unequipped to my framework, however the script won’t register the tools. If you add a tool into starterpack, and go in test mode it won’t print the tool but it will print that the player joined.
Here’s a sample of the code I’m using:
local function playerjoined(player)
print'player joined'
local backpack = player.Backpack
local function addTool(tool)
tool.Equipped:Connect(function()
print'equipped'
end)
end
for i,v in backpack:GetChildren() do
task.spawn(function()
addTool(v)
end)
end
backpack.ChildAdded:Connect(addTool)
end
for i,v in game.Players:GetPlayers() do -- in studio on startup player added dont load sometimes so i do this
task.spawn(function()
playerjoined(v)
end)
end
game.Players.PlayerAdded:Connect(playerjoined)