When The Ball Touches the goal it does not score but if we wait 10 minutes later it scored

so the scoring works after a few minutes but at the start of the game it does not

and i tried debugging it with prints and it only does the same

no errors

code


	local function TrueScore(hit, TeamName)
		print("worked")
		
		Scored.Value = true
		TimeRunning.Value = false
		hit.Equip.Disabled = true
		SpeedPlayers(0)
		Removal.Value = true
		FireText("Team"..TeamBall.Value.." Scores")
		TeamName.Value = TeamName.Value + 2
		
		repeat wait() until Scored.Value == true
		wait(2)
		for _, Player in pairs(game.Players:GetPlayers()) do
			if Team1Folder:FindFirstChild(Player.Name) then
				TeleportPlayers(Player, Team1Tp, 16)
			elseif Team2Folder:FindFirstChild(Player.Name) then
				TeleportPlayers(Player, Team2Tp, 16)
			end
		end
		Removal.Value = false
		ShotClock.Value = 24
		Scored.Value = false
		TimeRunning.Value = true
		if TeamBall.Value == 1 then
			CloneBall(Team2Tp)
		elseif TeamBall.Value == 2 then
			CloneBall(Team1Tp)
		else
			CloneBall(BallTip)
		end
		FireText("")
		
	end
	
	local function FalseScoring(hit, Name)
		print("worked")
		
		TimeRunning.Value = false
		hit.Equip.Disabled = true
		SpeedPlayers(0)
		Removal.Value = true
		FireText("False Scoring On "..Name)
		wait(2)
		for _, Player in pairs(game.Players:GetPlayers()) do
			if Team1Folder:FindFirstChild(Player.Name) then
				TeleportPlayers(Player, Team1Tp, 16)
			elseif Team2Folder:FindFirstChild(Player.Name) then
				TeleportPlayers(Player, Team2Tp, 16)
			end
		end
		Removal.Value = false
		ShotClock.Value = 24
		TimeRunning.Value = true
		if TeamBall.Value == 1 then
			CloneBall(Team2Tp)
		elseif TeamBall.Value == 2 then
			CloneBall(Team1Tp)
		else
			CloneBall(BallTip)
		end
		FireText("")
		
	end

	spawn(function()
		Team1Goal.Touched:Connect(function(hit)
			if hit.Parent:IsA("Tool") then
				if TeamBall.Value == 2 and not Debounce then
					if Team2Score.Value ~= 22 then
						Debounce = true
						TrueScore(hit, Team2Score)
						wait(1)
						Debounce = false
					elseif Team2Score.Value == 22 - 2 then
						Debounce = true
						GameFinished(TeamBall, Team2Score)
						wait(1)
						Debounce = false
					end
				elseif TeamBall.Value == 1 and not Debounce then
					Debounce = true
					FalseScoring(hit, hit.Values.BallHandler.Value)
					wait(1)
					Debounce = false
				end
			end
		end)
			
		Team2Goal.Touched:Connect(function(hit)
			if hit.Parent:IsA("Tool") then
				if TeamBall.Value == 1 and not Debounce then
					if Team1Score.Value ~= 22 then
						Debounce = true
						TrueScore(hit, Team1Score)
						wait(1)
						Debounce = false
					elseif Team1Score.Value == 22 - 2 then
						Debounce = true
						GameFinished(TeamBall, Team1Score)
						wait(1)
						Debounce = false
					end
					
				elseif TeamBall.Value == 2 and not Debounce then
					Debounce = true
					FalseScoring(hit, hit.Values.BallHandler.Value)
					wait(2)
					Debounce = false
				end
			end
		end)
	end)
	

Is this impossible bug solve able or not cause i cant solve it neither