Team tools don't work at all

Hi there. I’ve recently been working around some good tools which I’ve made not long ago, and of course I’ve taken the necessary precautions of coding a proper teamtools script (where it clones the tools from teams to the player’s backpack if on that team). However, it didn’t work, so I went to try on a few more solutions but searching it and trying every single code I could find.

After numerous times and rethinking my placement, it still doesn’t clone into a players backpack. Quick note to that as well, the only way for a player to join a new team is by clicking on a gui that teams the player, which is working entirely.

This is my layout (which is the standard layout for team tools)
image

If any of you have got solutions, let me know.

1 Like

We can’t really help you if you don’t show us your code.

I deleted my version of code, but here’s a new one I found:

local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(player)
	local function characterAdded(character)
		if player.Team then
			for _, potentialTool in ipairs(player.Team:GetChildren()) do
				if potentialTool:IsA("Tool") then
					potentialTool:Clone().Parent = player.Backpack
				end
			end
		end
	end

	player.CharacterAdded:Connect(characterAdded)

	if player.Character then
		characterAdded(player.Character)
	end
end)

Instead of this, put a script in starterplayercharacter scripts. try this:

local players = game:GetService("Players")

local player = players:GetPlayerFromCharacter(script.Parent)

local team = player.Team


if team then
	for _, v in pairs(team:GetChildren()) do
		if v:IsA("Tool") then
			v:Clone().Parent = player.Backpack
		end
	end
end

script:Destroy()
1 Like

It once again didn’t work, both in a serverscript and localscript.

Did you put the script in StarterCharacterScripts?

1 Like