Hello there, I have 2 scripts here where it's supposed to increase the player's IntValue in a leaderboard depending on how much parts a specific folder has, for example: If player is in red team and Red Folder has 5 parts, then in the leaderboard named "Blocks" he will have 5 blocks, however I do not know on how to go through this as I do not know how to get the player's specific team or value and I stopped learning how to script for 2 months due to it being complicated and discouraging, how do I remedy this?

SCRIPT 1:

local teams = game:GetService("Teams")

game.Players.PlayerAdded:connect(function(p)
	local stats = Instance.new("IntValue")
        stats.Name = "leaderstats"
        stats.Parent = p

	local block = Instance.new("IntValue")
	block.Name = "Blocks"	
        block.Value = 0
	block.Parent = stats
end)

SCRIPT 2:

local RedChildren = workspace.Blocks.Red:GetChildren()
local YellowChldren = workspace.Blocks.Yellow:GetChildren()
local BlueChildren = workspace.Blocks.Blue:GetChildren()
local PurpleChildren = workspace.Blocks.Purple:GetChildren()
local GreenChildren = workspace.Blocks.Green:GetChildren()

local leaderstats = game.Players:WaitForChild("leaderstats")
local Red = leaderstats:WaitForChild("Blocks")
local Yellow = leaderstats:WaitForChild("Blocks")
local Blue
local Purple
local Green

local function counter()
	local count1 = #RedChildren
	local count2 = #BlueChildren
	local count3 = #YellowChldren
	local count4 = #PurpleChildren
	local count5 = #GreenChildren
end



while true do
	print(counter)
end